add UDP support, and TCP listen support ipv6 now

This commit is contained in:
Cloud Wu
2014-11-12 23:00:44 +08:00
parent fa78623b1c
commit cfe9506a5a
7 changed files with 773 additions and 98 deletions

View File

@@ -8,6 +8,7 @@ struct skynet_context;
#define SKYNET_SOCKET_TYPE_CLOSE 3
#define SKYNET_SOCKET_TYPE_ACCEPT 4
#define SKYNET_SOCKET_TYPE_ERROR 5
#define SKYNET_SOCKET_TYPE_UDP 6
struct skynet_socket_message {
int type;
@@ -30,4 +31,9 @@ void skynet_socket_close(struct skynet_context *ctx, int id);
void skynet_socket_start(struct skynet_context *ctx, int id);
void skynet_socket_nodelay(struct skynet_context *ctx, int id);
int skynet_socket_udp(struct skynet_context *ctx, const char * addr, int port);
int skynet_socket_udp_connect(struct skynet_context *ctx, int id, const char * addr, int port);
int skynet_socket_udp_send(struct skynet_context *ctx, int id, const char * address, const void *buffer, int sz);
const char * skynet_socket_udp_address(struct skynet_socket_message *, int *addrsz);
#endif