0
所述的Labwindows文檔說以下有關ServerTCPRead方法:labwindows:ServerTCPRead究竟需要什麼參數?
int ServerTCPRead (unsigned int conversationHandle, void *dataBuffer, size_t dataSize, unsigned int timeOut);
DataBuffer中無效*指針到緩衝器在其中存儲的數據。
然而,當我真正聲明指針,並將它傳遞給方法,它具有以下錯誤返回:
FATAL RUN-TIME ERROR: "test1.c", line 146, col 61, thread id 0x00001474: Array argument too small (1 bytes). Argument must contain at least 60000 bytes (60000 elements).
這裏是我使用的代碼:
char * receiveBuf="";
ssize_t dataSize = 60000;
switch (event)
{
case TCP_CONNECT:
break;
case TCP_DATAREADY:
if ((dataSize = ServerTCPRead (g_hconversation, receiveBuf,
dataSize, 1000))
< 0)
{
//SetCtrlVal (g_hmainPanel, MAINPNL_RECEIVE, "Receive Error\n");
}
else
{
display_value_from_client(receiveBuf);
}
break;