Quote:
Originally Posted by Exolent[jNr]
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 *amx, cell *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 <0 )
return -1;
// By Reymon
MF_SetAmxString(amx, params[3], inet_ntoa(cin.sin_addr) , params[4]);
cell *port = MF_GetAmxAddr(amx, params[2]);
port = ntohs(cin.sin_port);
//
return NewClient;
}
__________________