Hello!

And here is the Question:

I made a Network Program.
When I recieve some data with the recv-function, can I then get the Name of the Computer which sent the data. But I think its not the name you got normaly with GetComputerName-function. It must be another one.

thx for help...
Posted on 2003-03-12 09:10:41 by ChigpA
Just put code into the client software to sent the information to you.

Regards, P1
Posted on 2003-03-12 12:07:11 by Pone
You can use "gethostname" from winsock2 to get the network computer name.

Start with WSAStartup and close with WSACleanup.
Posted on 2003-03-12 18:08:58 by Silas
When a connection request is made, you can extract the IP address of the computer trying to connect. In addition, you can use GetHostName to get the name. Once you accept the request you get the socket handle, just associate the name to the socket handle in some kind of array or structure.

When you recieve data, look at the socket handle that the data was recieved on and use your array/structure to lookup the hostname from that.

That's something like I would do it, there may be other/better ways.
Posted on 2003-03-13 05:34:45 by IRBMe
thx I tried it
and it works
Posted on 2003-03-13 07:54:58 by ChigpA