Sockets

This is for anyone who can help me.

I already have a server / client connecting over a UDP socket.

but the only thing I can do right now is send a message to the server.

I can have multiple clients connect to the server and send messages.

My question is how do I get the server to send the messages from clients to other clients ???

Client Code

# Client program

from socket import *

# Set the socket parameters
host = "localhost"
port = 21567
buf = 1024
addr = (host,port)

# Create socket
UDPSock = socket(AF_INET,SOCK_DGRAM)

def_msg = "===Enter message to send to server===";
print "
",def_msg

# Send messages
while (1):
	data = raw_input('>> ')
	if not data:
		break
	else:
		if(UDPSock.sendto(data,addr)):
			print "Sending message '",data,"'.....<done>"			

# Close socket
UDPSock.close()

And here is the server code

# Server program

from socket import *

# Set the socket parameters
host = "localhost"
port = 21567
buf = 1024
addr = (host,port)

# Create socket and bind to address
UDPSock = socket(AF_INET,SOCK_DGRAM)
UDPSock.bind(addr)

# Receive messages
while 1:
	data,addr = UDPSock.recvfrom(buf)
	if not data:
		print "Client has exited!"
		break
	else:
		print "
Received message '", data,"'"
		

# Close socket
UDPSock.close()

Any help would be appreciated…

Data received from client using UDP contains address of sender. Save these addresses for all clients and use them to send messages from server to client.

Thanks for the reply

I will try this…