Sign in to follow this  
Followers 0
JFee

Solved (I'm an idiot): How to get the local IP of current computer

5 posts in this topic

#1 ·  Posted (edited)

I am writing a set of a few programs that will be run on separate computers on the same network and communicate via TCP.

I have a server that does all of the receiving, and 2 controllers that send messages. For the controllers, the user enters the IP of the server at startup, which is fine because the Server IP may be different each time, but I do not want to have to do that for the server. I would like to automatically determine the local IP and use that as the IP it listens on.

Is there any way to do this? I am not sure where to start...

Edited by JFee

Regards,Josh

Share this post


Link to post
Share on other sites



Macro

@IPAddress1 ;IP address of first network adapter.

@IPAddress2 ;IP address of second network adapter. Returns 0.0.0.0 if not applicable.

I am writing a set of a few programs that will be run on separate computers on the same network and communicate via TCP.

I have a server that does all of the receiving, and 2 controllers that send messages. For the controllers, the user enters the IP of the server at startup, which is fine because the Server IP may be different each time, but I do not want to have to do that for the server. I would like to automatically determine the local IP and use that as the IP it listens on.

Is there any way to do this? I am not sure where to start...

Share this post


Link to post
Share on other sites

Hmm... but how do I know which is the current computer? This would be good if I was connecting to the same computer every time, but I can't find out the current one by this.


Regards,Josh

Share this post


Link to post
Share on other sites

Hmm... but how do I know which is the current computer? This would be good if I was connecting to the same computer every time, but I can't find out the current one by this.

What are you talking about? @IPAddress1 always returns the IP of the computer the script is running from.

Share this post


Link to post
Share on other sites

Woah, my bad. I was misreading the helpfile. Thought it was referring to the first IP on the LAN


Regards,Josh

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0