Thread: Connecting through a proxy...

  1. #1
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905

    Connecting through a proxy...

    How do I go about doing this using Winsock and a windows XP system?

    I've written some code that I know works in a non-proxy environment, but now with trying to test it here with the proxy it doesn't connect anymore. It fails here:

    Code:
    int ircConnect::connectToServer(char* serverName,int port)
    {
    	hostInf=gethostbyname(serverName);
    	if(!hostInf)
    	{
    		closesocket(iSocket);
    		return ec_HOST_ERROR;
    	}
    
    	memcpy(&sockAddr.sin_addr,hostInf->h_addr,4);
    	sockAddr.sin_family=AF_INET;
    	sockAddr.sin_port=htons(port);
    	if(connect(iSocket,(const sockaddr*)&sockAddr,sizeof(sockAddr))==SOCKET_ERROR)
    	{
    		closesocket(iSocket);
    		return ec_CONNECT_ERROR;
    	}
    
    	return ec_CONN_OK;
    }
    The bolded code is where it returns. WSAGetLastError returns WSAETIMEDOUT (10060).

    So...how do I go about connecting to a proxy? I would assume I just use that same function to connect to the proxy...but then what? How do I send requests through the proxy to the IRC channel?

  2. #2
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    I just tested out mIRC, I guess the ports it uses aren't allowed on the proxy here, so nevermind.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. proxy.pac (proxy auto config) question
    By boreder in forum C Programming
    Replies: 2
    Last Post: 01-20-2009, 03:13 AM
  2. Force connection through proxy
    By ShadowBeast in forum C# Programming
    Replies: 6
    Last Post: 05-02-2007, 01:35 PM
  3. Simple Proxy
    By Lina in forum C Programming
    Replies: 0
    Last Post: 04-01-2007, 12:36 PM
  4. DNS via proxy
    By iain in forum Tech Board
    Replies: 2
    Last Post: 02-26-2005, 04:59 AM