Home » U++ Library support » U++ MT-multithreading and servers » How to obtain IP/port information out of a socket
How to obtain IP/port information out of a socket [message #13721] |
Thu, 24 January 2008 12:07  |
cbpporter
Messages: 1427 Registered: September 2007
|
Ultimate Contributor |
|
|
Hi!
I have a server program which can accept multiple clients. I need to extract the IP information from the client socket (the one returned by accept), and then to send a message to the client so that it can become a server on another port. I couldn't find anything in sources/docs that gives this information.
|
|
|
|
|
|
|
Re: How to obtain IP/port information out of a socket [message #13835 is a reply to message #13830] |
Tue, 29 January 2008 14:43   |
captainc
Messages: 278 Registered: December 2006 Location: New Jersey, USA
|
Experienced Member |
|
|
Yes, I am using this on Windows Server 2003 running in VirtualBox virtual machine (as development platform). I'm not sure if that could be the issues as I have yet to test it with 32-bit Windows running directly on hardware.
Would the virtual machine be the issue?
Can someone else please test this?
For the time being, I am using:
String FormatIPStr(dword _ip)
{
byte ip[4];
Poke32be(ip, _ip);
#ifdef PLATFORM_WIN32
return Format("%d.%d.%d.%d", ip[1], ip[0], ip[3], ip[2]);
#else
return Format("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
#endif
}
[Updated on: Tue, 29 January 2008 14:48] Report message to a moderator
|
|
|
|
|
|
Goto Forum:
Current Time: Mon Apr 28 21:51:25 CEST 2025
Total time taken to generate the page: 0.04598 seconds
|