How can i make this socket connection works as is on Arduino
hi,
i use regular arduino ethernet shield
i'm trying use ~exact code in arduino project.
it's c, must easy do.
i'm not socket programming already.
thanks help.
i use regular arduino ethernet shield
i'm trying use ~exact code in arduino project.
it's c, must easy do.
i'm not socket programming already.
thanks help.
code: [select]
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <netdb.h>
int conn;
char sbuf[512];
int main() {
char *host = "some.domain";
char *port = "8080";
memset(&hints, 0, sizeof hints);
hints.ai_family = af_inet;
hints.ai_socktype = sock_stream;
getaddrinfo(host, port, &hints, &res);
conn = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
connect(conn, res->ai_addr, res->ai_addrlen);
while ((sl = read(conn, sbuf, 512))) {
...
... somthing here
...
}
}
i'm not quite sure trying accomplish.
do want connect arduino using c program computer?
or want program arduino ethernet capabilities using shield?
do want connect arduino using c program computer?
or want program arduino ethernet capabilities using shield?
Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > How can i make this socket connection works as is on Arduino
arduino
Comments
Post a Comment