86: re = http_get("t-engine.org", "/", buf, HTTP_BUFSIZE);
87: DEBUG_PRINT(("server_task: http_get = %d(%d, %d)\n", re, MERCD(re), SERCD(re)));
88: if ( re < 0 ) {
114: size = so_getaddrinfo(hostname, NULL, &hints, &res, NULL, 0, NULL);
115: DEBUG_PRINT(("test_getaddrinfo: so_getaddrinfo = %d(%d, %d)\n", size, MERCD(size), SERCD(size)));
116: if ( size < 0 ) {
122: re = so_getaddrinfo(hostname, NULL, &hints, &res, buf, size, NULL);
123: DEBUG_PRINT(("test_getaddrinfo: so_getaddrinfo = %d(%d, %d)\n", re, MERCD(re), SERCD(re)));
124: if ( re < 0 ) {
151: re = so_getnameinfo((struct sockaddr*)&sa, sizeof sa, buf, sizeof buf, buf2, sizeof buf2, 0, NULL);
152: DEBUG_PRINT(("test_getnameinfo: so_getnameinfo = %d(%d, %d)\n", re, MERCD(re), SERCD(re)));
153: if ( re < 0 ) {
161: re = so_getnameinfo((struct sockaddr*)&sa, sizeof sa, buf, sizeof buf, buf2, sizeof buf2, 0, NULL);
162: DEBUG_PRINT(("test_getnameinfo: so_getnameinfo = %d(%d, %d)\n", re, MERCD(re), SERCD(re)));
163: if ( re < 0 ) {
180: re = so_select(sd+1, &fdset, NULL, NULL, NULL);
181: DEBUG_PRINT(("wait_data: so_select = %d(%d, %d)\n", re, MERCD(re), SERCD(re)));
182: }
199: }
200: DEBUG_PRINT(("server_task: so_socket = %d(%d, %d)\n", sd, MERCD(sd), SERCD(sd)));
201:
206: re = so_bind(sd, (struct sockaddr*)&sa, sizeof sa);
207: DEBUG_PRINT(("server_task: so_bind = %d(%d, %d)\n", re, MERCD(re), SERCD(re)));
208: if ( re < 0 ) {
212: re = so_listen(sd, 5);
213: DEBUG_PRINT(("server_task: so_listen = %d(%d, %d)\n", re, MERCD(re), SERCD(re)));
214: if ( re < 0 ) {
221: reader = so_accept(sd, (struct sockaddr*)&sa2, &sa_len);
222: DEBUG_PRINT(("server_task: so_accept = %d(%d, %d)\n", reader, MERCD(reader), SERCD(reader)));
223: if ( reader < 0 ) {
230: re = so_sockatmark(reader);
231: DEBUG_PRINT(("server_task: so_sockatmark = %d(%d, %d)\n", re, MERCD(re), SERCD(re)));
232: if ( re < 0 ) {
235: re = so_read(reader, buf, 4);
236: DEBUG_PRINT(("server_task: so_read = %d(%d, %d), buf = %s\n", re, MERCD(re), SERCD(re), buf));
237: if ( re < 0 || memcmp(buf, "1234", 4) != 0 ) {
244: re = so_sockatmark(reader);
245: DEBUG_PRINT(("server_task: so_sockatmark = %d(%d, %d)\n", re, MERCD(re), SERCD(re)));
246: if ( re < 0 ) {
249: re = so_recv(reader, buf, 4, MSG_OOB);
250: DEBUG_PRINT(("server_task: so_recv = %d(%d, %d), buf = %s\n", re, MERCD(re), SERCD(re), buf));
251: if ( re < 0 || buf[0] != 'a' ) {
259: re = so_accept(sd, (struct sockaddr*)&sa2, &sa_len);
260: DEBUG_PRINT(("server_task: so_accept = %d(%d, %d)\n", re, MERCD(re), SERCD(re)));
261: if ( re != EX_INTR ) {
291: sd = so_socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
292: DEBUG_PRINT(("so_socket = %d(%d, %d)\n", sd, MERCD(sd), SERCD(sd)));
293: if ( sd < 0 ) {
301: re = so_connect(sd, (struct sockaddr*)&sa, sizeof sa);
302: printf("so_connect = %d(%d, %d)\n", re, MERCD(re), SERCD(re));
303: if ( re < 0 ) {
307: re = so_write(sd, "1234", 4);
308: DEBUG_PRINT(("so_write = %d(%d, %d)\n", re, MERCD(re), SERCD(re)));
309: if ( re < 0 ) {
313: re = so_send(sd, "a", 1, MSG_OOB);
314: DEBUG_PRINT(("so_send = %d(%d, %d)\n", re, MERCD(re), SERCD(re)));
315: if ( re < 0 ) {
322: re = so_break(server_tskid);
323: DEBUG_PRINT(("so_break = %d(%d, %d)\n", re, MERCD(re), SERCD(re)));
324: if ( re < 0 ) {