3 years, 6 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

3 years, 6 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.

Accepted Answer

Thanks a lot,.

posted by Peter Helebrand 10 Apr 2019