0

I am trying to make a TCP chat program, but instead of having people enter in the ip of the computer they wish to talk to everytime, i would like the program to be able to listen on all ip addresses, so that it will provide for a better user experience, and that i can have chat rooms with multiple people joining. I have the code working with entering in ips, however, when i use the IPAddress.any command it will not send messages. has anyone else done this?
Any help is greatly appreciated.
Thanks
~Matt

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by __avd
0

IPAddress.Any will automatically choose the network interface for you. To listen on a certain interface you have to use the correct IP.

You need to specify the IP address on which you want to listen, instead of IPAddress.Any.

For example,

For Each list In System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
    For Each ip In list.GetIPProperties().UnicastAddresses
        Console.WriteLine(ip.Address)
    Next
Next

Edited by __avd: n/a

0

so in a chat tcp chat program, what would be the most efficient way of connecting more then two users?

0

>so in a chat tcp chat program, what would be the most efficient way of connecting more then two users?

Read post #2 (Code).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.