Hi,
would it be possible to include a feature allowing to bind the TCPSocket with addr.sin_addr = INETADDR_ANY instead to only one single device?
Alex
Ok,
as usual I should have tried harder first (and it's INADDR_ANY). Anyway with the right constructor it works. But on the other hand it would be nicer to do
InetHostAddress server(NULL);
instead of
addr.sin_addr.s_addr = INADDR_ANY; addr.sin_family = AF_INET; addr.sin_port = htons(4711);
InetHostAddress server(addr.sin_addr);
Or have a special constructor for InetAddress and a constructor for TCPSocket that just takes InetAddress.
Cheers, Alex
In the latest code in the repository this has been done. You can now do
InetHostAddress server;
Which will create it with INADDR_ANY.
Log in to post a comment.
Hi,
would it be possible to include a feature allowing to bind the TCPSocket with addr.sin_addr = INETADDR_ANY instead to only one single device?
Alex
Ok,
as usual I should have tried harder first (and it's INADDR_ANY).
Anyway with the right constructor it works. But on the other hand it would be nicer to do
InetHostAddress server(NULL);
instead of
addr.sin_addr.s_addr = INADDR_ANY;
addr.sin_family = AF_INET;
addr.sin_port = htons(4711);
InetHostAddress server(addr.sin_addr);
Or have a special constructor for InetAddress and a constructor
for TCPSocket that just takes InetAddress.
Cheers, Alex
In the latest code in the repository this has been done. You can now do
InetHostAddress server;
Which will create it with INADDR_ANY.