X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=branches%2Fnota-show-app%2Fsrc%2Fts7200%2Ftest_client.c;fp=branches%2Fnota-show-app%2Fsrc%2Fts7200%2Ftest_client.c;h=c5f1a4b70c20df3144994d151d974f46c454a563;hb=71eece00473c745dbe74c7dd9abd6a5fa52ea3ab;hp=0000000000000000000000000000000000000000;hpb=496d310181c50d216bf2f44e9a970a791aa2aba0;p=jamendo diff --git a/branches/nota-show-app/src/ts7200/test_client.c b/branches/nota-show-app/src/ts7200/test_client.c new file mode 100644 index 0000000..c5f1a4b --- /dev/null +++ b/branches/nota-show-app/src/ts7200/test_client.c @@ -0,0 +1,54 @@ +#ifndef NOTAIO_H +#define NOTAIO_H + +#include +#include +#include +#include + +#define USE_H_IN3 //h_in2 or h_in3 + +#ifdef USE_H_IN3 +#include "nota3/h_in/h_bsdapi.h" +#else +#include "h_in.h" +#endif + +#define SID 1 +#define DEFAULT_PORT 0 + +int main() +{ + int sock, err; + char buf; + nota_addr_t addr = { SID, DEFAULT_PORT }; + sock = Hsocket( Hgetinstance(), AF_NOTA, SOCK_STREAM, 0 ); + if(sock < 0) + { + perror( "Hsocket" ); + exit( 1 ); + } + + err = Hconnect( Hgetinstance(), sock, (struct sockaddr*) &addr, sizeof(addr) ); + if( err != 0 ) + { + Hclose( Hgetinstance(), sock ); + perror( "Hconnect" ); + exit( 1 ); + } + + buf = 'a'; + err = Hsend( Hgetinstance(), sock, &buf, 1, 0 ); + if(err != 1) { + Hclose( Hgetinstance(), sock ); + perror( "Hsend" ); + exit( 1 ); + } + + printf( "Wyslano %d znakow: %c\n", err, buf ); + Hclose( Hgetinstance(), sock ); + + return 0; +} + +#endif