Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 8 months ago.
mbed-os-tcp-server-example
Hi anyone,
I am trying to send a simple script: http://shop.surveillance.cz/gprs_gw.php?type=2
this does not go anywhere:
socket.connect("shop.surveillance.cz", 80); char sbuffer[] = "GET /gprs_gw.php?type=2 HTTP/1.1"; socket.send(sbuffer, sizeof sbuffer);
server response is HTTP/1.1 400 Bad Request
I am using nucleo-F767zi Mbed
Can you help me? Thanks
1 Answer
6 years, 8 months ago.
Hi Peter, your description looks more like a TCPClient instead of a TCPServer how you write in the Title of this post.
Client
// definitions
#define SERVER "www.surveillance.cz"
#define PORT 80
#define HOST "shop.surveillance.cz"
#define GET "gprs_gw.php?type=2"
//Connect
socket.connect(SERVER, PORT);
//buffer
sprintf(sbuffer,"GET /%s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n", GET, HOST);
Snad jsem to pochopil správně a pomůže to. :)
Have a nice day
J.