예제 #1
0
파일: proxy.c 프로젝트: xinming90/corvus
struct connection *proxy_create(struct context *ctx, char *host, int port)
{
    struct connection *proxy;
    int fd = socket_create_server(host, port);
    if (fd == -1) return NULL;

    logger(INFO, "serve at %s:%d", host, port);

    proxy = malloc(sizeof(struct connection));
    proxy->ctx = ctx;
    proxy->fd = fd;
    proxy->ready = ready;
    mbuf_queue_init(&proxy->buf_queue);
    return proxy;
}
예제 #2
0
void ServerSocket::create(short port) {
	sock = socket_create_server(port);
}