fix
This commit is contained in:
parent
970b35d4c7
commit
05aab5ab41
24
client.py
Normal file
24
client.py
Normal file
@ -0,0 +1,24 @@
|
||||
from socket import *
|
||||
import sys
|
||||
|
||||
host = 'localhost'
|
||||
port = 777
|
||||
addr = (host,port)
|
||||
|
||||
udp_socket = socket(AF_INET, SOCK_DGRAM)
|
||||
|
||||
|
||||
data = input('write to server: ')
|
||||
if not data :
|
||||
udp_socket.close()
|
||||
sys.exit(1)
|
||||
|
||||
#encode - перекодирует введенные данные в байты, decode - обратно
|
||||
data = str.encode(data)
|
||||
udp_socket.sendto(data, addr)
|
||||
data = bytes.decode(data)
|
||||
data = udp_socket.recvfrom(1024)
|
||||
print(data)
|
||||
|
||||
|
||||
udp_socket.close()
|
||||
@ -6,11 +6,11 @@ from socket import socket, AF_INET, SOCK_DGRAM
|
||||
#from os import chdir, path
|
||||
from threading import Thread
|
||||
|
||||
host = '10.10.13.2'
|
||||
host = '10.10.18.3'
|
||||
port = 7747
|
||||
addr = (host,port)
|
||||
|
||||
irc_host = '10.200.201.4'
|
||||
irc_host = 's1.tomasgl.piv'
|
||||
irc_port = 6667
|
||||
irc_chat_name = '#notifications'
|
||||
irc_bot_nickname = 'GandC_LogMon_Bot'
|
||||
@ -43,4 +43,5 @@ while True:
|
||||
message, addr = s.recvfrom(1024) # receive message
|
||||
print('client addr: ', addr)
|
||||
print('info: ', message)
|
||||
irc.connection.privmsg(irc_chat_name, message)
|
||||
s.close()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user