Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » How to obtain IP/port information out of a socket
Re: How to obtain IP/port information out of a socket [message #13848 is a reply to message #13839] Tue, 29 January 2008 22:41 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14261
Registered: November 2005
Ultimate Member
Confirmed as bug. Thanks.

Please check this fix:

SOCKET Socket::Data::AcceptRaw(dword *ipaddr, int timeout_msec)
{
	ASSERT(IsOpen());
	if(!Peek(timeout_msec, false))
		return INVALID_SOCKET;
	sockaddr_in addr;
	Zero(addr);
	socklen_t addr_len = sizeof(addr);
//	puts("Socket::Accept: accepting socket...");
	SOCKET connection = accept(socket, (sockaddr *)&addr, &addr_len);
	if(connection == INVALID_SOCKET) {
		SetSockError("accept");
		return INVALID_SOCKET;
	}
//	puts("Socket::Accept: socket accepted...");
	dword ip = ntohl(addr.sin_addr.s_addr);
	if(ipaddr)
		*ipaddr = ip;
	SLOG("Socket::Accept() -> " << (int)connection << " &" << FormatIP(ip));
	return connection;
}


Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: MT Documentation
Next Topic: Conditional Variables
Goto Forum:
  


Current Time: Mon Jun 09 11:52:01 CEST 2025

Total time taken to generate the page: 0.04622 seconds