B
–
6
Appendix B
space_left = len;
while (1)
{
// block here until data is received of timeout expires
result = select(hSocket, &rd_set, NULL, NULL, &tval);
if (result < 1)
{
TCP_ClearDevice();
MessageBox(0, sCommandBuffer, "Read timeout", MB_OK);
return -1;
}
// get the header info first
accum = 0;
while (1)
{
memset(&header, 0, sizeof(TCP_HEADER));
if ((result = recv(hSocket, (char *) & accum, sizeof(header) - accum, 0)) < 0)
{
TCP_ClearDevice();
MessageBox(0, "Unable to receive header info from the server.", "ERROR", MB_OK);
return -1;
}
accum += result;
if (accum>=sizeof(header))
break;
}
header.iLength = ntohl(header.iLength);
if (header.iLength < 1)
return 0;
// only read to len amount
if (header.iLength > space_left)
{
header.iLength = space_left;
sprintf(tmpStr, "Read buffer size (%d bytes) is too small", len);
MessageBox(0, tmpStr, "ERROR", MB_OK);
}
// read the rest of the block
accum = 0;
while (1)
{
idxPtr = buf + (buf accum);
bytes_more = header.iLength - accum;
if ((space_left-accum) < TCP_MINIMUM_PACKET_SIZE)
{
TCP_ClearDevice();
Summary of Contents for LSA1000
Page 2: ...Operator s Manual LeCroy LSA1000 Signalyst Revision B October 1998 ...
Page 6: ...iii Contents ...
Page 9: ...v Foreword ...
Page 14: ...1 1 Read This First 1 ...
Page 28: ......
Page 29: ...2 1 2 About the LSA1000 ...
Page 34: ...3 1 3 Installation and Safety ...
Page 42: ...4 8 Connecting to PC or Network Example of responses for IDN and CONET queries ...
Page 43: ...4 1 4 Connecting to PC or Network ...
Page 55: ...5 12 LSA1000 Software Tools Remote LSA display of LSA1000 s External Reference Out Waveform ...
Page 63: ...5 20 LSA1000 Software Tools ...
Page 66: ...5 1 5 LSA1000 Software Tools ...
Page 72: ......
Page 73: ...A 1 A Appendix A Specifications ...
Page 83: ......
Page 84: ...B 1 Appendix B NET_CON Source Code B ...
Page 96: ......
Page 97: ...C 1 C Appendix C Parameter Measurement ...
Page 104: ...D 1 D Appendix D Program Examples ...
Page 107: ...E 1 E Appendix E Suggestion Forms ...
Page 108: ...Index ...
Page 109: ......
Page 114: ...Index ...