Client-Side Example
Below is a small code example of creating an AstaConnection and connecting to a remote ASTA SkyWire™ server from the Digital Ink demo client.
AstaHandle Params = AstaParamLstCreate();
AstaParamLstSetLongInt(Params, 0, total_pixels, TEXT("Total"));
AstaParamLstSetBlob(Params, 1, tlist, total_pixels * 3,
TEXT("Sequence"));
AstaHandle conn = AstaClConvCreate();
if (conn)
{
if (AstaClConvOpenConnection(conn, AddressBuf, Port))
{
bool sent = AstaClConvSendParamList(conn, MsgID, Params);
AstaParamLstDestroy(Params);
if (!sent)
{
int i = AstaClConvGetLastError(conn);
MessageBox(0, TEXT("Failed to send data"), NULL, 0);
}
AstaClConvReceiveStream(conn, &tlist, &tlsize);
AstaClConvCloseConnection(conn);
}
else
{
AstaParamLstDestroy(Params);
MessageBox(0, TEXT("Failed to connect to server"), NULL, 0);
}
}
AstaClConvDestroy(conn);
|
|