This project has moved. For the latest updates, please go here.

finding IP adres

Nov 10, 2013 at 12:41 PM
Hello, great job with this new EV3 API. I just made a small start project using the API but I have a small question. I used:
_brick = new Brick(new NetworkCommunication("192.168.178.19")); to make a wifi connection. It works but is there a way to get the used IP adres automaticly?

I looked at the sample but I can not understand how it works...... (not enough C# skills yet!)

greeting from Holland André
Coordinator
Nov 10, 2013 at 3:35 PM
That is currently not possible. Sorry!
Nov 25, 2013 at 4:41 AM
When the brick is connected to the network with wifi and lauch the EV3 software it finds the brick. That means EV3 brick must be sending some UDP broadcast or something with the IP information. So I believe there must be a way to get the ip address. I hope someone can figure that out. Otherwise EV3 software would not be able to just see it without being connected.
Coordinator
Nov 25, 2013 at 4:45 AM
I didn't mean it wasn't possible at all, I mean it's not possible with the current library. I have it on the list for a future version, but no ETA on when that will be available.
Coordinator
Nov 25, 2013 at 4:46 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Dec 1, 2013 at 6:21 PM
I found a way to do this. When EV3 is connected to the router, it broadcast a message on UDP port 3015 that has the serial number and the model. So I can search the text for "EV3" for broadcast message on this port. I can get the ip address from the broadcast message. EV3 broadcast this every few seconds. You can integrate this functionality to this library. For now I use this in my program to discover the ip address of EV3.
Coordinator
Dec 1, 2013 at 6:46 PM
Yes. I had this written and working but removed it and went with the static IP address because it can often take a few seconds for that UDP broadcast to arrive. I thought it would be confusing to start your app and have to wait until the brick is found and connected. Perhaps I was being too conservative. :) I'll be sure to put the code back in for the next version and allow a direct IP connection, or the auto-discovery depending on how the user wants to use it.
Dec 2, 2013 at 4:10 AM
That would be great. You can overload the connection method to wait or async. Also you can provide a method to discover ip or have a event triggered when the ip is discovered. There are many ways to handle it. But this can makes life easier because we do not have to manually enter the IP address every time we run an application. Waiting a few seconds for auto discovery should be ok.

Well, another issue I have with the connection is that how do I know whether a connection is made to the EV3 brick ? What if the connection parameters given to the connectAsync is wrong ? I believe it would time out trying to connect but it does not return an error code right ? Does it raise and exception if fail to connect ?
Coordinator
Dec 2, 2013 at 5:51 AM
nuwans wrote:
Well, another issue I have with the connection is that how do I know whether a connection is made to the EV3 brick ? What if the connection parameters given to the connectAsync is wrong ? I believe it would time out trying to connect but it does not return an error code right ? Does it raise and exception if fail to connect ?
It should time out and throw an exception. If it isn't, let me know.