11 years, 8 months ago.

Letting client know mbed's ip address

My mbed is using DHCP and does transmit TCP packets. The clients can receive the packets fine, however they do not know what IP address they need to listen to. How do I let the clients know what my mbed's ip address is?

Thanks, Hamid

2 Answers

11 years, 8 months ago.

If clients can receive packets fine, I suppose you use this function :

int accept ( TCPSocketConnection &connection)

From the TCPSocketConnection object you can use the following function :

char * get_address (void) Get the IP address of this endpoint.

More information at this link : http://mbed.org/handbook/Socket

Hope it can help you

11 years, 8 months ago.

Thank you for your response Raph. I should have elaborated on the question more. The client could receive the packets because I let the client know what address was assigned to server (mbed in this case) by DHCP. I thought about multicasting mbeds ip address as UDP packets and once the clients have this information transmit data as TCP packets. Including the 2 libraries however leads to other issues.

I thought others might have run into this problem as well and there is probably a simple solution for it.

Thanks, Hamid

In case of just a hobby project: Fix the IP address of your mbed in your router's settings?

I don't have experience with network stuff, but if it is intended for home networks, couldn't you make your clients scan for the mbed? Send a packet on a specific port and see if anyone is listening? On a home network there aren't that many IP addresses to try.

posted by Erik - 23 Dec 2013