I've been learning interprocess communication. My last project used tempfiles to send data and commands back and forth. Now I want to try using sockets. Can you show me how to make a basic client/server architecture in python using sockets?
system
main interprocess sanchaar sikh rahaa hum.meri antim pariyojna ne data or cmand bhejne ke liye Tempfiles kaa upyog kiya.ab main sockets kaa upyog karne kii koshish karnaa chahta hum.kya aap mujhe dikhaa sakate hai ki paythan main sockets kaa upyog karke ek buniyadi client/sarwar architekchar kaise banaaya jaae?
user
nishchit rup se!ham do prakriyaaon ke bich samvaad karne ke liye paythan ke socket modul kaa upyog kar sakate hai.yahan ek udhaaharan karyanvayan he.

aayaat socket
# server.py

# sarwar socket banaaen
server_socket = socket.socket (socket.af_inet, socket.sock_stream)

# socket ko localhost se baandhen: 8000
server_address = ('localhost', 8000)
server_socket.bind (server_address)

# conection ke liye suno
server_socket.listen (1)
print (f "{server_address} par sunanaa")
client_socket, client_address = server_socket.accept ()
print (f "{client_address} connected")

# client se data sweekaar karen
data = client_socket.recv (1024)
print (f "{data}")

# client ko waapas iko massej
client_socket.sendall (f "sandesh praapt: {data}". encode ('utf-8')))

# nikat sambandh
client_socket.close ()

...

aayaat socket
# client.py

# client socket banaaen
client_socket = socket.socket (socket.af_inet, socket.sock_stream)

# socket ko sarwar se conect karen
server_address = ('localhost', 8000)
client_socket.connect (server_address)
print (f "{server_address} se judaa")

# sarwar ko namaste kaho
sandesh = "hello, sarwar!"
client_socket.sendall (message.encode ())

# sarwar se pratikriya sweekaar karen
data = client_socket.recv (1024)
print (f "{data.decode ()}")

# nikat sambandh
client_socket.close ()
assistant
<|system|>
</s>
<|user|>
main interprocess sanchaar sikh rahaa hum.meri antim pariyojna ne data or cmand bhejne ke liye Tempfiles kaa upyog kiya.ab main sockets kaa upyog karne kii koshish karnaa chahta hum.kya aap mujhe dikhaa sakate hai ki paythan main sockets kaa upyog karke ek buniyadi client/sarwar architekchar kaise banaaya jaae?</s>
<|assistant|>
nishchit rup se!ham do prakriyaaon ke bich samvaad karne ke liye paythan ke socket modul kaa upyog kar sakate hai.yahan ek udhaaharan karyanvayan he.

aayaat socket
# server.py

# sarwar socket banaaen
server_socket = socket.socket (socket.af_inet, socket.sock_stream)

# socket ko localhost se baandhen: 8000
server_address = ('localhost', 8000)
server_socket.bind (server_address)

# conection ke liye suno
server_socket.listen (1)
print (f "{server_address} par sunanaa")
client_socket, client_address = server_socket.accept ()
print (f "{client_address} connected")

# client se data sweekaar karen
data = client_socket.recv (1024)
print (f "{data}")

# client ko waapas iko massej
client_socket.sendall (f "sandesh praapt: {data}". encode ('utf-8')))

# nikat sambandh
client_socket.close ()

...

aayaat socket
# client.py

# client socket banaaen
client_socket = socket.socket (socket.af_inet, socket.sock_stream)

# socket ko sarwar se conect karen
server_address = ('localhost', 8000)
client_socket.connect (server_address)
print (f "{server_address} se judaa")

# sarwar ko namaste kaho
sandesh = "hello, sarwar!"
client_socket.sendall (message.encode ())

# sarwar se pratikriya sweekaar karen
data = client_socket.recv (1024)
print (f "{data.decode ()}")

# nikat sambandh
client_socket.close ()</s>
