Please note that the CVS and issue trackers have moved to GitHub. These Trac pages are no longer kept up-to-date.

root/seattle/branches/nacl_repy/seattlelib/tests/ut_lind_net_listen.py

Revision 5725, 0.8 KB (checked in by nitin, 5 years ago)

added user/group identity calls, fixed some unit tests.

Line 
1import lind_test_server
2
3from emultimer import createthread as createthread
4
5from emulmisc import exitall
6
7from time import sleep
8
9from lind_net_constants import *
10
11SyscallError = lind_test_server.SyscallError
12
13# I'll listen, accept, and connect...
14
15serversockfd = lind_test_server.socket_syscall(AF_INET, SOCK_STREAM, 0)
16
17clientsockfd = lind_test_server.socket_syscall(AF_INET, SOCK_STREAM, 0)
18
19
20# bind to a socket
21lind_test_server.bind_syscall(serversockfd,'127.0.0.1',50300)
22
23lind_test_server.listen_syscall(serversockfd,10)
24
25def do_server():
26 
27  newsocketfd = lind_test_server.accept_syscall(serversockfd)
28
29
30createthread(do_server)
31
32
33# wait for the server to run...
34sleep(.1)
35
36# should be okay...
37lind_test_server.connect_syscall(clientsockfd,'127.0.0.1',50300)
38assert(lind_test_server.getpeername_syscall(clientsockfd) == ('127.0.0.1',50300))
39
40
Note: See TracBrowser for help on using the browser.