forked from pranayrai/VicChat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
42 lines (33 loc) · 765 Bytes
/
server.py
File metadata and controls
42 lines (33 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import socket
import sys
import threading
s = socket.socket()
host = socket.gethostname()
port = 9999
s.bind((host, port))
s.listen(5)
c = None
c2 = None
if c is None:
# Halts
print '[Waiting for connection...]'
c, addr = s.accept()
print 'Got connection from', addr
if c2 is None:
c2, addr2 = s.accept()
print 'Got connection from', addr2
while True:
if c is not None:
# Halts
#print '[Waiting for response...]'
#print 'receiving data from %s'%ad
q = c.recv(1024)
#q = raw_input("Enter something to this client: ")
c2.send(q)
if c2 is not None:
# Halts
#print '[Waiting for response...]'
#print 'receiving data from %s'%ad
q = c2.recv(1024)
#q = raw_input("Enter something to this client: ")
c.send(q)