How to get IP address of client from server 
Author Message
 How to get IP address of client from server

If I have something like the following ...

   server = TCPServer.new("0.0.0.0", 1234)

   while (session = server.accept()) != nil
      puts session.addr
   end

It always shows me the server end IP address.  Is it possible to find out
the address of the client that initiated the connection?



Tue, 18 May 2004 11:40:48 GMT  
 How to get IP address of client from server

Quote:

> It always shows me the server end IP address.  Is it possible to find out
> the address of the client that initiated the connection?

Try #peeraddr


Tue, 18 May 2004 12:05:29 GMT  
 How to get IP address of client from server

Quote:

> If I have something like the following ...

>    server = TCPServer.new("0.0.0.0", 1234)

>    while (session = server.accept()) != nil
>       puts session.addr
>    end

> It always shows me the server end IP address.  Is it possible to find out
> the address of the client that initiated the connection?

Does session.peeraddr do what you want?

Hope this helps,

Mike

--

http://www.stok.co.uk/~mike/       | GPG PGP Key      1024D/059913DA

http://www.starnix.com/            |                  75D2 9EC4 C1C0 0599 13DA



Tue, 18 May 2004 17:32:02 GMT  
 How to get IP address of client from server
Thanks guys.  No idea how I missed that ... it was the next method in the
documentation !!  Works perfectly ... as one would expect.
.


Tue, 18 May 2004 19:21:30 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Anyway to get the server ip address not the browser ip address

2. Getting Client's IP Address

3. getting clients ip address

4. IP-Address of NT-Client in VA-ST 4.0

5. How do I get the clients IP address ?

6. Getting the IP Address within RB

7. getting current ip-address

8. C5 - TCP/IP Client/Server and DirectX Questions

9. Winsock Woes - Getting IP Address

10. TCP/IP server & client in CW2xxxx

11. Interest in TCP/Ip Server & Client

12. Client - Server slow tcp/ip...

 

 
Powered by phpBB® Forum Software