PDA

Click to See Complete Forum and Search --> : Get client ip adress or pc name with winsock?


Neophyte|NL
May 18th, 2006, 10:07 AM
hi, i have a question

I am also using winsock to send some text to a server, but is it possible
that i can send the ip from the client to the server.
What i want to do is, that when the server gets that ip, he will automatically connect to that client.

greetz Neophyte

ok i tried to get it with this code what i placed in the server form:


Dim Received As String

winsock1.GetData Received
fs = Left(Received, 1)
If fs = "E" Then
fs2 = Right(Received, Len(Received) - 1)
client.winsock1.remotehost = fs2
client.winsock1.remoteport = 88
client.winsock1.connect


this did not work :S

budy500000
May 19th, 2006, 07:19 PM
there is no need for the server to make a new connection. you could not use the same winsock1 controle aneyway without closing the old connection. the server is alredy connected and is able to reply once the client is connected. (it is connected if it can send a string to the server). look up somthing like "vb6 simple chat" on google.
i appoligise for my spelling

Neophyte|NL
May 21st, 2006, 04:49 AM
no problem for spelling..

i figured something out with the code i wrote above.
But it wil have the code in the textbox and i do not want that.

but thanks for reply i will search on google.

thanks

lone_REBEL
May 24th, 2006, 03:22 AM
The problem shuold be pretty simple.
First of all you need to have an unused socket.
Now when you connect the client to the server (since n networking its always the client that requests) automatically its IP will go to the server and will be usable in the ConnectionRequest sub and the IP will be in RequestID