CSocket.GetLineFrom 方法 |
命名空间: VO
1FUNCTION ServerTest2() AS VOID PASCAL 2 LOCAL oSocket AS CSocket 3 LOCAL cData AS STRING 4 LOCAL cFrom AS STRING 5 LOCAL nPort AS INT 6 7 oSocket := CSocket{SOCK_DGRAM} 8 9 IF oSocket:bind(7, NULL_STRING, AF_INET) 10 oSocket:TimeOut := 10000 11 cData := oSocket:GetLineFrom(@cFrom, @nPort) 12 13 IF cFrom == NULL_STRING 14 ? "Timeout expired, no data received :-(" 15 ELSE 16 ? "Data received from ", cFrom, , "Client port: ", NTrim(nPort) 17 ? "Received data:" , cData 18 ENDIF 19 ENDIF 20 21oSocket:Close() 22 23RETURN