For some reason when trying to create a socket connection to a given port on at a given IP, the socket gets created at the local computer's ip instead. Here is my code:
- Code: Select all Expand view
oSocket := TSocket():New( 15000 )
osocket:lDebug := .t.
oSocket:cLogfile := cFilePath( GetModuleFileName( GetInstance() ) ) + "trace.log"
oSocket:bRead = { | oSocket | aadd( m->aAcks, oSocket:GetData() ) }
oSocket:bConnect = { || logfile( "trace.log", { "Connected to ip:"+osocket:cIpAddr } ) }
oSocket:Connect( "98.19.1.4" )
Here I'm trying to connec to a local server at ip 98.19.1.4 which is listening on port 15000. But when I look at the trace.log file I find it is connecting to ip 98.19.1.187 which is the local computer's ip and not to the desired ip, thus any send/receive data attemp fails.
Any Ideas why?
The funny thing is that yesterday it was connecting to the right ip and I got to send and receive data just perfectly. I know as a matter of fact that the server is listening at 15000 and that the server's ip is correct.
I'm using xharbour 0.99.61 w/FW2.7 + BCC 5.5.
Reinaldo.