TcpSocket should be able to listen on specific IP
|Assignee:||Jan Dolinár||% Done:|
TcpSocket::Listen should take optional parameter that would allow it to listen on specific IP address, e.g. only on localhost. Default should still be listen to any traffic (0.0.0.0 or ::).
Two patches are attached, first implements the functionality described above, second uses it in Skylark (which is the reason why I started with this ;) ). I'm not 100% happy with those patches, but they do work well. What is IMHO missing is some class that would make it simpler to a) pass IPv4 and IPv6 and b) provide some utility functions to provide simple conversion of IP addresses from/to string. The current use of IpAddrInfo in the skylark.patch is definitely not nice nor readable.
Also, the IPv6 code in TcpSocket::Listen() was not entirely correct, so I improved it as well.
Mirek, can you please look at it when you get some spare time? Thanks.
#2 Updated by Jan Dolinár over 7 years ago
- Status changed from Ready for QA to Approved
- % Done changed from 50 to 100
Thanks for including and improving the patches. Works fine, just one little detail - I believe the line 191 in Skylark/App.cpp shouldn't be there:
addrinfo *addr = ipinfo.GetResult();