Synced include files

This commit is contained in:
David Anderson
2004-09-10 03:12:38 +00:00
parent 0a74f09273
commit 5043a40c51
14 changed files with 1150 additions and 8 deletions

51
plugins/include/sockets.inc Executable file
View File

@ -0,0 +1,51 @@
/*
*
* AMX Mod X Module
* Basic Socket Functions
*
* Codebase from Ivan, -g-s-ivan@web.de (AMX 0.9.3)
* Modification by Olaf Reusch, kenterfie@hlsw.de (AMXX 0.16, AMX 0.96)
*
*/
#if defined _socket_included
#endinput
#endif
#define _socket_included
// Use SOCKET_TCP for TCP Socket connections
#define SOCKET_TCP 1
// Use SOCKET_UDP for UDP Socket connections
#define SOCKET_UDP 2
/* Opens a new connection to hostname:port via protocol (either SOCKET_TCP or SOCKET_UDP),
* returns a socket (positive) or negative or zero on error.
* States of error:
* 0 - no error
* 1 - error while creating socket
* 2 - couldn't resolve hostname
* 3 - couldn't connect to given hostname:port
*/
native socket_open(_hostname[], _port, _protocol = SOCKET_TCP, &_error);
/* Closes a Socket */
native socket_close(_socket);
/* Recieves Data to string with the given length */
native socket_recv(_socket, _data[], _length);
/* Sends data to the Socket */
native socket_send(_socket, _data[], _length);
/* This function will return true if the state (buffer content) have changed within the last recieve or
* the timeout, where timeout is a value in <20>Seconds, (1 sec =1000000 <20>sec).
* Use to check if new data is in your socket. */
native socket_change(_socket, _timeout=100000);