Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import socket
import pickle
#setting the header
head = 64
#setting port number
port = 5050
#setting msg type as uf-8
msg_type = 'utf-8'
#value for disconnection msg
disconnet = "Connection Disconneted"
#getting the ip from computer
client_ip = socket.gethostbyname(socket.gethostname())
#bundling server name and port number
client_address = (client_ip, port)
#declaring socket connetion for the client
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(client_address)
#defing funtion to send message
def client_send(msg):
#encoding message to be send
message = msg.encode(msg_type)
#encoding message length
msg_length = len(message)
#encoding message length
send_length = str(msg_length).encode(msg_type)
#adding paddinf to msg
send_length += b' ' * (head - len(send_length))
#sending the message
client.send(send_length)
client.send(message)
print(client.recv(2048).decode(msg_type))
#inputing the booking details
msg=str(input("Enter the revertion in the order[Name] [Type of Ticket] [Quantity of Adults tickets] [Quantity oChildrens Tickets] "))
client_send(msg)
#inputing class details
msg=str(input("\n\n which classes do you book addtion if yes type ['y'] [class] [adult ticket] [children ticket] else type 'n' "))
client_send(msg)
input ()
client_send(disconnet)