Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi there,

Basically I have to design a chat room using UDP multicasting. (Assignment)

Clients connect to the Server, sends messages to it, Server relays the message to all clients at once using multicasting.

I've looked for examples and tutorials but haven't found anything that's been helpful to me personally. I've read the class documents on MSDN for UDPclient ect but I'm still not getting there.

Can a "host/server" receive messages through a multicast channel? or is it only 1 way transmission: "host" to "client"? Do I need a separate channel/socket to listen for messages from the clients?

Any resources/links would be much appreciated!

In my head it's basically this:

Server

Dim server As UDPClient
Start new Thread Listener()

Sub Listener()
Loop
server.receive() 'Check for Data waiting
If there is data, pass it to MulticastSender()
End Loop
End Sub

Sub MulticastSender(message)
UDPClient.multicast(localhost)
UDPClient.Send(message)
End Sub

Client
Start new Thread Listener()
Dim client As UDPClient

Sub Listener()
Loop
client.receive() 'Check for Data waiting
If there is data, print to output Textbox
End Loop
End Sub

Sub Send() Handles SendButton
message = txtInput.Text 'Get Data from input Textbox
UDPClient.Send(message)
End Sub

I know that isn't actual code, it's just an example of the logic

Basically if someone could assist me turning the logic into code, I'd greatly appreciate it.

Also I hope I've posted this is the right place. Sorry if I haven't, I've only been a member for about a week.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900