C# sockaddr to sockaddr_in
问题 I am writing an application in C# that hooks the connect function call of another program and reads the IP it is connecting to. (I know it is IPv4) Currently it hooks, intercepts and forwards the function call and I get the variables but since connect in winsock is called with a sockaddr* variable as the second argument, I need cast this to a sockaddr_in to get the IP address. (Unless there is a way to retrieve the ip out of the sa_data field, which I couldn't find information about.) This is