I'm making a program that uses winsock and I want the user to be able to specify what IP address and port they desire. My problem is that it doesn't try to connect on the specified port... ------------------------------------------------------ .data? Port dd ? IPAddr dd ? Socket dd ? ... .code ... invoke WSAStartup, 101h, ADDR WSAData invoke socket, AF_INET, SOCK_STREAM, 0 mov Socket, EAX invoke WSAAsyncSelect, Socket, hWnd, WM_SOCKET,\ FD_CONNECT + FD_READ + FD_CLOSE mov Sin.sin_family, AF_INET invoke GetWindowText, hwndEdit2, ADDR Port, 5 invoke htons, ADDR Port mov Sin.sin_port, AX invoke GetWindowText, hwndEdit, ADDR IPAddr, 15 invoke inet_addr, ADDR IPAddr mov Sin.sin_addr, EAX invoke connect, Socket, ADDR Sin, SIZEOF Sin ... -------------------------------------------------- I think it's because when I "GetWindowText" it returns ^characters^ not integers. If this is the problem, how do I change the characters to integers? Thanx, *unknown*
Posted on 2001-04-12 17:13:00 by *unknown*
It's cause you're getting the port number in text. So use GetDlgItemInt instead of GetWindowText or convert it your self.
Posted on 2001-04-12 17:38:00 by Soul~Drudge