commit
db6bd7fb2b
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,23 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredPackages">
|
||||
<value>
|
||||
<list size="10">
|
||||
<item index="0" class="java.lang.String" itemvalue="requests-oauthlib" />
|
||||
<item index="1" class="java.lang.String" itemvalue="Werkzeug" />
|
||||
<item index="2" class="java.lang.String" itemvalue="Flask-Assets" />
|
||||
<item index="3" class="java.lang.String" itemvalue="SQLAlchemy" />
|
||||
<item index="4" class="java.lang.String" itemvalue="libsass" />
|
||||
<item index="5" class="java.lang.String" itemvalue="requests" />
|
||||
<item index="6" class="java.lang.String" itemvalue="Flask-SQLAlchemy" />
|
||||
<item index="7" class="java.lang.String" itemvalue="Jinja2" />
|
||||
<item index="8" class="java.lang.String" itemvalue="Flask-Login" />
|
||||
<item index="9" class="java.lang.String" itemvalue="Flask" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.11 (UDPNetworking)" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (UDPNetworking)" project-jdk-type="Python SDK" />
|
||||
</project>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/UDPNetworking.iml" filepath="$PROJECT_DIR$/.idea/UDPNetworking.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,32 @@
|
||||
import socket
|
||||
|
||||
HOST = '192.168.50.106'
|
||||
PORT = 2000
|
||||
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
|
||||
s_addr = (HOST, PORT)
|
||||
server_address = (s_addr)
|
||||
# 1 para español, 2 para ingles, 3 para aleman
|
||||
|
||||
while True:
|
||||
idioma = input("Ingrese el idioma: ")
|
||||
if idioma == "español":
|
||||
message = b"1"
|
||||
break
|
||||
elif idioma == "ingles":
|
||||
message = b"2"
|
||||
break
|
||||
elif idioma == "aleman":
|
||||
message = b"3"
|
||||
break
|
||||
else:
|
||||
print("Ingrese un idioma valido")
|
||||
|
||||
# enviar
|
||||
print('Enviando {}'.format(message))
|
||||
sent = s.sendto(message, server_address)
|
||||
|
||||
# recibir
|
||||
print('Esperando por la respuesta')
|
||||
data, server = s.recvfrom(1024) # línea bloqueante
|
||||
print('Recibido: {}'.format(data))
|
@ -0,0 +1,24 @@
|
||||
import socket
|
||||
HOST = ''
|
||||
PORT = 2000
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
|
||||
s_addr = (HOST, PORT)
|
||||
s.bind(s_addr)
|
||||
while True:
|
||||
#recibir
|
||||
datos, addr = s.recvfrom(1024) #línea bloqueante
|
||||
print('recibidos {} bytes de {}'.format(len(datos), addr))
|
||||
print(datos)
|
||||
#enviar
|
||||
if datos:
|
||||
|
||||
if datos == b"1":
|
||||
s.sendto(b"hola", addr)
|
||||
elif datos == b"2":
|
||||
s.sendto(b"hello", addr)
|
||||
|
||||
elif datos == b"3":
|
||||
s.sendto(b"hallo", addr)
|
||||
|
||||
else:
|
||||
s.sendto(b"Lenguaje no reconocido", addr)
|
@ -0,0 +1,19 @@
|
||||
import socket
|
||||
|
||||
HOST = '192.168.50.106'
|
||||
PORT = 2000
|
||||
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
|
||||
s_addr = (HOST, PORT)
|
||||
server_address = (s_addr)
|
||||
cadena = input("Por favor, introduce una cadena: ")
|
||||
message = bytes(cadena, 'utf-8')
|
||||
|
||||
# enviar
|
||||
print('Enviando {!r}'.format(message))
|
||||
sent = s.sendto(message, server_address)
|
||||
|
||||
# recibir
|
||||
print('Esperando por la respuesta')
|
||||
data, server = s.recvfrom(1024) #línea bloqueante
|
||||
print('recibidos {!r}'.format(data))
|
@ -0,0 +1,16 @@
|
||||
import socket
|
||||
|
||||
HOST = ''
|
||||
PORT = 2000
|
||||
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
|
||||
s_addr = (HOST, PORT)
|
||||
s.bind(s_addr)
|
||||
while True:
|
||||
datos, addr = s.recvfrom(1024)
|
||||
print("recibidos {} bytes de {}".format(len(datos), addr))
|
||||
print(datos)
|
||||
|
||||
if datos:
|
||||
sent = s.sendto(b"Saludos desde el servidor UDP", addr)
|
||||
print('enviados {} bytes a {}'.format(sent, addr))
|
Loading…
Reference in new issue