Der_Andi Posted October 19, 2007 Share Posted October 19, 2007 Hi all, normally, you have to specify the server's ip adress and the port number, if you want to TCPConnect it. Is there a way, to make the client find this ip adress automatically? Link to comment Share on other sites More sharing options...
corz Posted October 19, 2007 Share Posted October 19, 2007 If it's a server on your local LAN, you could simply run through the available IP's (your subnet) and attempt to connect to them. If it's not local, I don't know. It would be easier if the server was broadcasting its address somehow, but you didn't mention whether you were also writing the server part. ;o) (or nothing is foolproof to the sufficiently talented fool.. Link to comment Share on other sites More sharing options...
Der_Andi Posted October 19, 2007 Author Share Posted October 19, 2007 If it's a server on your local LAN, you could simply run through the available IP's (your subnet) and attempt to connect to them. If it's not local, I don't know.It would be easier if the server was broadcasting its address somehow, but you didn't mention whether you were also writing the server part.Yes, i wrote the server, too, and i already had the idea of broadcasting the IP. But i don't know how to realize that at all.This script could/would run at my university's LAN. There i get the ip address via DHCP, so it would be very comfortable, if i don't had to inform all the other participants of my current address. Link to comment Share on other sites More sharing options...
corz Posted October 19, 2007 Share Posted October 19, 2007 It would probably be a lot easier to just setup a proper host name for the server. Then whatever supplies DNS locally could handle all the tricky stuff. That's the way it's done world-wide, aka. "the internet". The clients then simply point themselves at "the-server", or whatever you decide to call it. Check here.;o)(or nothing is foolproof to the sufficiently talented fool.. Link to comment Share on other sites More sharing options...
Der_Andi Posted October 19, 2007 Author Share Posted October 19, 2007 (edited) Sure, the hostname! Should work with an uncommon hostname. But i just found a way, how to send and receive the broadcast. First, run the following script. It runs, until you close it via standard tray icon. UDPStartup() $socket = UDPBind(@IPAddress1, 65000) If @error <> 0 then Exit While 1 $data = UDPRecv($socket, 50) If $data <> "" Then MsgBox(0, "", $data, 1) EndIf Sleep(1000) WEnd Change the IP addresses, if necessary. Edited October 20, 2007 by Der_Andi Link to comment Share on other sites More sharing options...
corz Posted October 19, 2007 Share Posted October 19, 2007 Yup, broadcasts are pretty much always UDP. But hosts is the way to go methinks. Hosts FTW! I'm not just blatantly plugging my own pages, they get quite enough hits without any help from me! ;o) (or nothing is foolproof to the sufficiently talented fool.. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now