cURL / Mailing Lists / curl-library / Single Mail

curl-library

curl_easy_perform failing when target is behind a NAT

From: Harry 2Learn <wanting2learn_at_hotmail.co.uk>
Date: Thu, 10 Nov 2011 12:29:43 +0000

I am using curl in my c++ program to retrieve a url from a web server on two different linux machines.Before I try to get the URL I try to connect to the server initially using the below code.
I have the following options set:
CURLcode tResult = CURLE_OK;curl_easy_setopt ( pstdEasy, CURLOPT_HTTPHEADER, pstdTransferData->pstdHeaders );curl_easy_setopt ( pstdEasy, CURLOPT_HTTPGET, TRUE );curl_easy_setopt ( pstdEasy, CURLOPT_NOBODY, TRUE );curl_easy_setopt ( pstdEasy, CURLOPT_WRITEFUNCTION, OnReceiveHttpResponse );curl_easy_setopt ( pstdEasy, CURLOPT_WRITEDATA, pstdEasy );
curl_easy_perform ( pstdEasy );

the content of pstdTransferData->pstdHeaders is as follows:User-Agent: MyDeviceNameContent-Type: text/xmlExpect:Accept: text/xml, text/html, application/xmlConnection: Keep-AliveAccept-Language: EN
I have two linux machines each with identical software and apache webserver the only difference is that one of them is behind a NAT with port forwarding set up.Machine A has an address of 80.20.30.1Machine B has an address of 192.168.200.1 which is behind a NAT with an address of 80.20.30.2.
The problem is that when I try to connect to Machine B (Which is behind the NAT) I get the response to be CURLE_GOT_NOTHING instead of CURLE_OK which is what I get when I connect to Machine A.
What could be wrong here? Why is the call failing when the target is behind a NAT.
If you need any more info just ask.
Thanks
Harry

                                               

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-11-10