SAM version 3 :

- Raw and Datagram sessions implemented
      - option "SILENT=true" added to the stream protocol
      - java 6 warnings removed
   ministreaming :
      - java 6 warnings removed
   ministreaming and streaming :
      -  added functions : 
      	I2PServerSocket.waitIncoming(long timeout)
      	I2PServerSocket.accept(boolean block)
This commit is contained in:
mkvore-commit
2009-04-02 08:22:31 +00:00
parent 9aa8707647
commit a4d16af95d
44 changed files with 2278 additions and 183 deletions

View File

@ -0,0 +1,41 @@
#!/usr/bin/python
# echo server
# accepts a socket on specified port, writes on stdout and send back incoming data
import socket
import sys
if len(sys.argv)>=2 :
port = eval(sys.argv[1])
else : port = 25000
#create an INET, STREAMing socket
serversocket = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
#bind the socket to a public host,
# and a well-known port
serversocket.bind(("0.0.0.0", port))
#become a server socket
serversocket.listen(1)
#accept connections from outside
(clientsocket, address) = serversocket.accept()
#now do something with the clientsocket
#in this case, we'll pretend this is a threaded server
i = 0
while 1 :
chunk = clientsocket.recv(1024)
i = i + 1
sys.stdout.write(str(i)+' '+chunk)
if not chunk: break
clientsocket.send(str(i)+' '+chunk)
clientsocket.close()
print