2017-01-08 16:36:28 +01:00
|
|
|
#if defined _AsyncSocket_included
|
2015-05-21 19:29:14 +02:00
|
|
|
#endinput
|
|
|
|
#endif
|
2017-01-08 16:36:28 +01:00
|
|
|
#define _AsyncSocket_included
|
2015-05-21 19:29:14 +02:00
|
|
|
|
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();
|
2017-01-08 16:36:28 +01:00
|
|
|
|
2015-05-21 19:29:14 +02:00
|
|
|
public native bool Connect(const char[] host, const int port);
|
2017-01-08 16:36:28 +01:00
|
|
|
|
|
|
|
public native bool Listen(const char[] host, const int port);
|
|
|
|
|
2017-08-02 22:03:07 +02:00
|
|
|
public native bool Write(const char[] data, int length = -1);
|
2017-01-08 16:36:28 +01:00
|
|
|
|
2015-05-21 19:29:14 +02:00
|
|
|
public native bool SetConnectCallback(AsyncSocketConnectCallback callback);
|
2017-01-08 16:36:28 +01:00
|
|
|
|
2015-05-21 19:29:14 +02:00
|
|
|
public native bool SetErrorCallback(AsyncSocketErrorCallback callback);
|
|
|
|
|
2017-01-08 16:36:28 +01:00
|
|
|
public native bool SetDataCallback(AsyncSocketDataCallback callback);
|
2015-05-21 19:29:14 +02:00
|
|
|
}
|
|
|
|
|
2017-01-08 16:36:28 +01:00
|
|
|
/**
|
|
|
|
* Do not edit below this line!
|
|
|
|
*/
|
|
|
|
public Extension __ext_AsyncSocket =
|
2015-05-21 19:29:14 +02:00
|
|
|
{
|
2017-01-08 16:36:28 +01:00
|
|
|
name = "AsyncSocket",
|
|
|
|
file = "AsyncSocket.ext",
|
2015-05-21 19:29:14 +02:00
|
|
|
#if defined AUTOLOAD_EXTENSIONS
|
|
|
|
autoload = 1,
|
|
|
|
#else
|
|
|
|
autoload = 0,
|
|
|
|
#endif
|
|
|
|
#if defined REQUIRE_EXTENSIONS
|
|
|
|
required = 1,
|
|
|
|
#else
|
|
|
|
required = 0,
|
|
|
|
#endif
|
|
|
|
};
|
2017-01-08 16:36:28 +01:00
|
|
|
|
|
|
|
#if !defined REQUIRE_EXTENSIONS
|
|
|
|
public __ext_AsyncSocket_SetNTVOptional()
|
|
|
|
{
|
|
|
|
MarkNativeAsOptional("AsyncSocket.AsyncSocket");
|
|
|
|
MarkNativeAsOptional("AsyncSocket.Connect");
|
|
|
|
MarkNativeAsOptional("AsyncSocket.Listen");
|
|
|
|
MarkNativeAsOptional("AsyncSocket.Write");
|
|
|
|
MarkNativeAsOptional("AsyncSocket.SetConnectCallback");
|
|
|
|
MarkNativeAsOptional("AsyncSocket.SetErrorCallback");
|
|
|
|
MarkNativeAsOptional("AsyncSocket.SetDataCallback");
|
|
|
|
}
|
|
|
|
#endif
|