'Example, send a packet of 3000 and it returns 2,920 bytes?
'Send packets from 1-byte to 1460 and never an error.
'Is this a program error or perhaps adjustable on each machine?
'Buffer over-run, perhaps?
'Ive tested this for days and can't get reliable results with a packet over 1460 bytes.
'This program is Echo client (which comes with PB) modified to send
'many requests to the EchoServ with the LogEvent removed.
Got tab stops back,some how?
'Send packets from 1-byte to 1460 and never an error.
'Is this a program error or perhaps adjustable on each machine?
'Buffer over-run, perhaps?
'Ive tested this for days and can't get reliable results with a packet over 1460 bytes.
'This program is Echo client (which comes with PB) modified to send
'many requests to the EchoServ with the LogEvent removed.
Got tab stops back,some how?
Code:
'Why does this only return 2,920 bytes? #COMPILE EXE #DIM ALL %MaximumPacket1460 = 1460 $SERVER = "" FUNCTION PBMAIN () AS LONG LOCAL buffersize AS LONG LOCAL Attempt AS LONG LOCAL PacketLength AS LONG 'don't exceed 1460 LOCAL nSocket AS LONG LOCAL sBuffer AS STRING LOCAL sPacket AS STRING LOCAL totalBytesSent AS DWORD TCP OPEN PORT 999 AT "192.168.0.100" AS nSocket TIMEOUT 5000 IF ERR THEN ? "Error opening port: " + STR$(ERR) EXIT FUNCTION END IF FOR Attempt = 1 TO 1000 PacketLength = 3000 'do not send packets larger than 1460 bytes 'IF PacketLength > %MaximumPacket1460 THEN ' ? "Sorry, unpredictable results can happen with a buffer larger than 1460" ' EXIT FUNCTION 'END IF IF LEN(COMMAND$) THEN TCP PRINT nSocket, COMMAND$; ELSE TCP SEND nSocket, STRING$(PacketLength,"X") END IF ERRCLEAR sPacket = "" DO TCP RECV nSocket, 8192, sBuffer sPacket = sPacket + sBuffer LOOP UNTIL sBuffer = "" OR ISTRUE EOF(nSocket) OR ISTRUE ERR IF ERR THEN IF ERR = 24 THEN ? "Request has timed-out on the client on attempt"+ STR$(Attempt):EXIT FUNCTION ? "Error in client" + STR$(ERRCLEAR) END IF IF LEN(sPacket) <> PacketLength THEN ? "Failed on attempt" + STR$(Attempt) + " packet returned" + STR$(LEN(sPacket)) EXIT FUNCTION END IF TotalBytesSent = TotalBytesSent + LEN(sPacket) NEXT ? "No errors, bytes received back " + FORMAT$(TotalBytesSent,"#,") TCP CLOSE nSocket END FUNCTION
Comment