Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Java/Python
Socket
0 → 65.535 Socket
Puerto Puerto
Dirección Dirección
IP TCP / UDP IP
El ejemplo
?
Networking
JAVA
6
Socket TCP servidor
Socket cliente;
cliente = server.accept();
Socket TCP cliente
Socket cliente
¿Y los datos?
Subproceso
2
Subproceso
1
Proceso
principal
10
¿Cómo construirlo?
PYTHON
12
El lenguaje Python
Python
2.X 3.X
(Oct. 16 / 2000) (Dec. 3 / 2008)
Modules
Twisted, PyQT, PySide, numpy, Django, Flask, py2exe, etc.
¿Cual version usar?
• 2.7? (2010)
– No more releases.
– Extended support for this end-of-life release
• 3.5? (2015)
– Standard library improvements, for example, are only
available by default in Python 3.x.
– 5 years of background
¿Cómo funciona?
• Python
• Anaconda (Continuum)
– IDE: Spyder (Data Scientist)
– Management by Command line
Algunos comandos
• >conda
• >python --version
• >conda
• >conda --version
• >conda update --help
• >conda update conda
• >conda update anaconda
• >conda update python
• >conda search python
Algunos comandos
socket(arg1, arg2)
Argumento 1 Argumento 2
socket.AF_UNIX socket.SOCK_STREAM
socket.AF_INET socket.SOCK_DGRAM
socket.AF_INET6 socket.SOCK_RAW
socket.SOCK_RDM
socket.SOCK_SEQPACKET
Server TCP en Python
while 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
ct = client_thread(clientsocket)
ct.run()
Socket server Python
Socket TCP cliente en Python