-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathserver.py
More file actions
executable file
·50 lines (34 loc) · 955 Bytes
/
server.py
File metadata and controls
executable file
·50 lines (34 loc) · 955 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
43
44
45
46
47
48
49
50
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Author: Robin David
License: GNU GPLv3
Repo: https://github.com/RobinDavid
Copyright (c) 2012 Robin David
PyStack is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version http://www.gnu.org/licenses/.
'''
import pystack.pystack_socket as socket
HOST = '192.168.0.21' # The remote host
#HOST = "www.google.fr"
PORT = 7777 # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("localhost",PORT))
s.listen(2)
cli, addr = s.accept()
print(addr)
#print("--")
while True:
data = cli.recvfrom(2048)
print data
cli.send("OK")
break
if data.startswith("quit"):
break
else:
print(len(data), data)
cli.close()
s.close()
s.stop() #To stop stack