This commit is contained in:
GandC Snow 2021-10-25 11:46:48 +03:00
parent 970b35d4c7
commit 05aab5ab41
2 changed files with 27 additions and 2 deletions

24
client.py Normal file
View 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()

View File

@ -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()