View Single Post
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 11-18-2009 , 18:49   Re: Module: Sockets_hz ( listenning + nonblocking ) ... working :)
Reply With Quote #33

Quote:
Originally Posted by Exolent[jNr] View Post
I would like to retrieve the IP that is connecting to the socket.
I dont test, buts I know that is like this.... hz then update it....

PHP Code:
// native socket_accept(_socket, &port, ip[], iplen);
static cell AMX_NATIVE_CALL socket_accept(AMX *amxcell *params)  /* 2 param */
{
    
int NewClient;
    
struct sockaddr_in cin
    
int sinsize;
    
int socket params[1];
    
NewClient accept(socket, (struct sockaddr*)&cin, (socklen_t*)&sinsize); //hz

    
if ( NewClient <)
       return -
1;

    
// By Reymon
    
MF_SetAmxString(amxparams[3], inet_ntoa(cin.sin_addr) , params[4]);
    
cell *port MF_GetAmxAddr(amxparams[2]);
    
port ntohs(cin.sin_port);
    
//

    
return NewClient;

__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots