Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
SRP_TcpClient Non-Numeric Error
Trying to receive data from TCP client, getting following non-numeric error line 75 of SRP_TcpClient (see attachment)
Works fine if i just receive only but that doesnt work...but if I send then receive, throws the error, help?
oh and dll is v1.5.9
Works fine if i just receive only but that doesnt work...but if I send then receive, throws the error, help?
oh and dll is v1.5.9
// Connect to a local socket, send data, receive data, and then close
TcpClientHandle = 0
BytesToRead = 10
BytesActuallyRead = 0
If SRP_TcpClient(TcpClientHandle, "CONNECT", "127.0.0.1", "80") then
// Send the string
SRP_TcpClient(TcpClientHandle, "SEND", "GET /")
// Receive the bytes
Data = SRP_TcpClient(TcpClientHandle, "RECEIVE", BytesToRead, BytesActuallyRead)
// Close
SRP_TcpClient(TcpClientHandle, "CLOSE")
end
Comments
Buffer = Str(\00\, Param1) Param2 = SRPUtilitiesAPI_TcpClientReceive(Object, GetPointer(Buffer), Param1) Ans = Buffer[1, Param2]
Based on your code, there are two spots where this error would occur. The first is line 1, but that only happens if your BytesToRead variable is somehow not set to a number. The other spot is line 2, but that only happens if SRPUtilitiesAPI_TcpClientReceive returns something other than a number. Since C++ is typed, SRPUtilitiesAPI_TcpClientReceive will always return an integer. However, OI will sometimes throw this error if there is a DLL version mismatch. I hope this info provides guidance as to where to look. Perhaps just a re-install of SRP Utilities just to make sure everything is synced up?
I tested this on my end using SocketTest 3.0, and I can't get the same error to occur.