CountHostIps() Question
Blitz3D Forums/Blitz3D Beginners Area/CountHostIps() Question
| ||
Hey. I am trying to make a LAN Messenger and I was wondering what CountHostIPs() actually returns. Does it return everyones' IP addresses who are hosting something or does it return only your's? Thanks |
| ||
bump |
| ||
Searched... 30 seconds later... Answered:- http://www.blitzbasic.com/Community/posts.php?topic=29675#314440 Note Stoop Solo's post. And... thank you! :) Dabz |
| ||
Returns the count of YOUR local IP interfaces |
| ||
Returns the count of YOUR local IP interfaces Thanks, that answers my question and here is my second: Is there anyway to return the IP's of someone who is on a networked game that you made? |
| ||
The someones are clients, and they can use the broadcast address, and send a message on a specified port. Your application will listen on that specified port, and when you receive the message you'll have the IP, and the message data ie might say 'Hi' Like most things there are others ways to do the same thing. |
| ||
I'm sorry, I was rereading what I had put down earlier and noticed that I had asked my question wrong. How would you connect to an LAN networked computer that is using the same port and same program without having the IP address of said computer? There we go. Sorry about that once more. |
| ||
This example assumes one is using UDP. I'd select a high port number like 32000 (so you don't interfere with other services that normally use lower port numbers), and have the program listen for a message. If I didn't receive a message within say 20 seconds send a message out port 32000 with the broadcast address (see code archive). Sending a message using the broadcast IP is like sending the message to all 255 computers on your subnet. Once the listening computer receives the message, the listening computer will have the senders IP. Does that help, or do you need actual code ? |
| ||
Well I'm using TCP. Do you have code for that? Thanks for this, by the way |