2015-05-21 19:29:14 +02:00
|
|
|
/*
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
#if defined _async_socket_included
|
|
|
|
#endinput
|
|
|
|
#endif
|
|
|
|
#define _async_socket_included
|
|
|
|
|
2015-05-21 21:59:45 +02:00
|
|
|
typedef AsyncSocketConnectCallback = function void(AsyncSocket socket);
|
2015-05-21 19:29:14 +02:00
|
|
|
|
2015-05-21 21:59:45 +02:00
|
|
|
typedef AsyncSocketErrorCallback = function void(AsyncSocket socket, int error, const char[] errorName);
|
2015-05-21 19:29:14 +02:00
|
|
|
|
2015-05-21 21:59:45 +02:00
|
|
|
typedef AsyncSocketDataCallback = function void(AsyncSocket socket, const char[] data, const int size);
|
2015-05-21 19:29:14 +02:00
|
|
|
|
2015-05-21 21:59:45 +02:00
|
|
|
methodmap AsyncSocket < Handle {
|
|
|
|
public native AsyncSocket();
|
2015-05-21 19:29:14 +02:00
|
|
|
|
|
|
|
public native bool Connect(const char[] host, const int port);
|
|
|
|
|
|
|
|
public native bool Write(const char[] data);
|
|
|
|
|
|
|
|
public native bool SetConnectCallback(AsyncSocketConnectCallback callback);
|
|
|
|
|
|
|
|
public native bool SetErrorCallback(AsyncSocketErrorCallback callback);
|
|
|
|
|
|
|
|
public native bool SetDataCallback(AsyncSocketDataCallback callback);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
#if !defined REQUIRE_EXTENSIONS
|
|
|
|
public __ext_INTERFACE_SetNTVOptional()
|
|
|
|
{
|
|
|
|
MarkNativeAsOptional("");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
*/
|
|
|
|
|
|
|
|
public Extension __ext_INTERFACE =
|
|
|
|
{
|
|
|
|
name = "async_socket",
|
|
|
|
file = "async_socket.ext",
|
|
|
|
#if defined AUTOLOAD_EXTENSIONS
|
|
|
|
autoload = 1,
|
|
|
|
#else
|
|
|
|
autoload = 0,
|
|
|
|
#endif
|
|
|
|
#if defined REQUIRE_EXTENSIONS
|
|
|
|
required = 1,
|
|
|
|
#else
|
|
|
|
required = 0,
|
|
|
|
#endif
|
|
|
|
};
|