XPort can only connect to web hosted on Dedicated Server?

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
wonderkind
 
Posts: 12
Joined: Mon Mar 23, 2009 4:01 pm

XPort can only connect to web hosted on Dedicated Server?

Post by wonderkind »

I have tested lots of website for connection...using Xport
Seems like Xport can only connect to web hosted on dedicated server

ladyada.net using dedicated server.. of course it can connect well
of course twitter using dedicated server!
Xport seems also cannot connect well with Web using Dedicated IP without Dedicated Server
my php website setup using Dedicated IP but in Shared Hosting,it cannot connect at all =(

Do you all have the same of this kind of problem?
Moving to Dedicated Server will eat my wallet

User avatar
blalor
 
Posts: 35
Joined: Tue Jan 06, 2009 11:37 pm

Re: XPort can only connect to web hosted on Dedicated Server?

Post by blalor »

You're not providing much information here (like the problem you're experiencing, errors you're getting, or sample code), but I think I can guess what your problem is. Your problem is not that your server's on a "shared server" but that your web server is using virtual hosting (ie. multiple host names for a single IP address). When your browser tries to load http://www.google.com/, for example, it resolves "www.google.com" to "74.125.91.99", connects to port 80 at that host, and then sends:

Code: Select all

GET / HTTP/1.0
Host: www.google.com

The "Host" header sent by the client is what tells the web server which domain you're trying to connect to. I suspect that adding the hostname to your request will solve the problem. If not, send more details! :D

JohnOC
 
Posts: 9
Joined: Thu Apr 02, 2009 2:15 pm

Re: XPort can only connect to web hosted on Dedicated Server?

Post by JohnOC »

In the tweet-a-watt project the xport does not connect to the internet directly at all. A Python script running on a PC that the xport receiver is connected to is what does the connecting to twitter. There is no reason that a script like that cannot submit data to a web form on a shared server, using HTTP.

wonderkind
 
Posts: 12
Joined: Mon Mar 23, 2009 4:01 pm

Re: XPort can only connect to web hosted on Dedicated Server?

Post by wonderkind »

I'm using Xport Direct...

Here's my configuration:

*** Channel 1
Baudrate 9600, I/F Mode 4C, Flow 00
Port 00081
Connect Mode : D4
Send '+++' in Modem Mode enabled
Show IP addr after 'RING' enabled
Auto increment source port disabled
Remote IP Adr: --- none ---, Port 00000
Disconn Mode : 00 Disconn Time: 00:00
Flush Mode : 00


My problem is the unstable connection to my own webserver using Xport Direct
It is only this -> C12.34.56.78

the problem maybe at my Xport Configuration or Coding for Connection


if I'm working on Twitter.. I'll use Port 10001, btw I have tried both ...port 81 and port 10001 for my own website...I read about problem with Firewall issue that make me set up port 81 here http://www.glacialwanderer.com/hobbyrobotics/?p=15....i'm not sure though ..I have tested both port

Sometime it can connect ..sometime disconnect..but usually... it will disconnect
I'm using Dedicated IP...Shared Hosting...I'm using godaddy.com as my hosting ..the Deluxe one...my Xport Direct connection is just like in the ladyada example


I'm using Newsoftserial library..and ladyada AF_Xport library to make connection...bcoz it works perfect for twitter.com..and several website like ladyada.net..of course.... videocopilot.net..works fine

Here's my snippet for connection, do I need to send more data to Server after IP address and Port connection?

Snippet from main.cpp

ret = xport.connect(IPADDR, PORT);

Snippet from AF_Xport.cpp

uint8_t AF_XPort::connect(char *ipaddr, long port) {
char ret;


xportserial.print('C');
xportserial.print(ipaddr);
xportserial.print('/');
xportserial.print(port);
xportserial.print('\n'); //I have tested both with \r or \n here
// wait for 'C'
if (serialavail_timeout(3000)) { // 3 second timeout
ret = xportserial.read();

if (ret != 'C') {
return ERROR_BADRESP;
}
} else {
return ERROR_TIMEDOUT;
}
return 0;
}


do I need to reply after connection can be made?
like ....

#define WEB_HOST "HOST: http://www.example.net\n\n"
xport.print(WEB_HOST);

if connection can be made...everything works fine...to fetch data
here's the snippet of code for GET after connection

xport.print("GET ");
xport.print(PHP_PAGE_LOCATION);
xport.print(" HTTP/1.1\n");
xport.print(WEB_HOST);

Currently I'm not using .htaccess (in my web coding)to redirect someone who's typing IP number to my domain name...It'll just appear in browser as IP number..... like if you type "207.58.139.246" (ladyada.net) in browser, it'll just pint to "207.58.139.246" ..not resolve to domain name "www.ladyada.net".. but the content of web page is still the same
Last edited by wonderkind on Wed Apr 08, 2009 2:43 pm, edited 1 time in total.

User avatar
blalor
 
Posts: 35
Joined: Tue Jan 06, 2009 11:37 pm

Re: XPort can only connect to web hosted on Dedicated Server?

Post by blalor »

I'm afraid I still don't understand the problem you're having. I'm not familiar with the XPort, myself, unfortunately, so I'm not much help there.

Are you able to reliably *connect* to port 80, 81, or 10001 on your server? Are you getting disconnected when you don't expect to be? Are you trying to send multiple HTTP requests via a single connection?

HTTP 1.1 supports "keep-alive", but I know very little about this feature. For simple clients like yours, I would recommend specifying "HTTP/1.0". HTTP 1.0 will still support the Host header (and it's "Host: ", not "HOST: "), but the connection will be closed by the server after each response is completed. You might try running Wireshark on the same physical network as your XPort to see if the HTTP conversation looks correct.

The typical flow will be that your client connects to the server, requests the URL to retrieve, sends the Host header, sends a blank line, and waits for the response. The server replies with a status line, headers and a blank line, and then the actual data of the response. Then, unless you're using keep-alive, the connection will be closed by the server.

Does that help?

wonderkind
 
Posts: 12
Joined: Mon Mar 23, 2009 4:01 pm

Re: XPort can only connect to web hosted on Dedicated Server?

Post by wonderkind »

It has worked perfectly after I changed some Xport Channel 1 configuration
FlushMode I set to 33 and Disconnection Mode to 10 seconds

btw, the way my web server sending packet data is quite different with the way twitter server sending data. Twitter server usually send data in a big chunks, my web server send data in much more smaller packets. btw I have managed to handle it !

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”