forked from smilejay/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemp-socket.py
More file actions
27 lines (19 loc) · 464 Bytes
/
temp-socket.py
File metadata and controls
27 lines (19 loc) · 464 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
# use this socket server to debug an issue.
import socket
address = ('127.0.0.1', 8100)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(address)
s.listen(5)
while(True):
ss, addr = s.accept()
print 'got connected from', addr
ss.send('byebye')
ra = ss.recv(512)
print ra
for i in ra.split('\r\n\r\n'):
print i
for i in ra.split('\r\n'):
print i.encode('hex')
print i
ss.close()
s.close()