Undefined reference to getaddrinfo

Isn’t it the same problem as here ? http://programmingrants.blogspot.com/2009/09/tips-on-undefined-reference-to.html Basically do not forget to link with Ws2_32.lib (the message is from the linker, so that’s should be the reason) but you seem to be doing that already. … if you’re working with an old version of windows programming tools say to it you have a … Read more

Delphi, How to get all local IPs?

in indy 9, there is a unit IdStack, with the class TIdStack fStack := TIdStack.CreateStack; try edit.caption := fStack.LocalAddress; //the first address i believe ComboBox1.Items.Assign(fStack.LocalAddresses); //all the address’ finally freeandnil(fStack); end; works great 🙂 from Remy Lebeau’s Comment The same exists in Indy 10, but the code is a little different: TIdStack.IncUsage; try GStack.AddLocalAddressesToList(ComboBox1.Items); Edit.Caption … Read more

TCP/IP connection on a specific interface

Use the bind() function to bind the socket to either 192.168.1.3 or 192.168.1.2 before calling connect(), ConnectEx(), or WSAConnect(). That tells the socket which specific interface to use for the outgoing connection. For example: SOCKET s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); sockaddr_in localaddr = {0}; localaddr.sin_family = AF_INET; localaddr.sin_addr.s_addr = inet_addr(“192.168.1.3”); bind(s, (sockaddr*)&localaddr, sizeof(localaddr)); sockaddr_in remoteaddr … Read more

Are TCP SOCKET handles inheritable?

Short answer No, SOCKETs should not be marked inheritable. When certain Layered Service Providers (LSPs) are installed, the inherited handles simply can’t be used in the child. As an added irritation, see the related issue “Can TCP SOCKETS be marked non-inheritable?”. Briefly, you can’t rely on being able to inherit the sockets, but nor can … Read more

C++ Winsock P2P

Since I don’t know what information you are looking for, I’ll try to describe how to set up a socket program and what pitfalls I’ve run into. To start with, *read the Winsock tutorial at MSDN. This is a basic program to connect, send a message and disconnect. It’s great for getting a feel for … Read more