alright i think i will go the c/C++ way so please suggest some good books winsock programming.... i am currently reading Linux socket programming by example looks pretty decent so far i am able to understand the programs but was unable to compile it under my Ubuntu 8.04 with gcc 4
please take a looks at it
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
int
main(int argc,char **argv) {
int z; /* Status return code */
int s[2]; /* Pair of sockets */
/*
* Create a pair of local sockets:
*/
z = socketpair(AF_LOCAL,SOCK_STREAM,0,s);
if ( z == -1 ) {
fprintf(stderr,
“%s: socketpair(AF_LOCAL,SOCK_STREAM,0)\n”,
strerror(errno));
return 1; /* Failed */
}
/*
* Report the socket file descriptors returned:
*/
printf(“s[0] = %d;\n”,s[0]);
printf(“s[1] = %d;\n”,s[1]);
system(“netstat --unix -p”);
return 0;
}
the error returned is ...
cryptid@black-box:~/Socket_sandbox$ gcc -o pro 01LST01.c
01LST01.c: In function ‘main’:
01LST01.c:13: error: stray ‘\342’ in program
01LST01.c:13: error: stray ‘\200’ in program
01LST01.c:13: error: stray ‘\234’ in program
01LST01.c:13: error: expected expression before ‘%’ token
01LST01.c:13: error: stray ‘\’ in program
01LST01.c:13: error: stray ‘\342’ in program
01LST01.c:13: error: stray ‘\200’ in program
01LST01.c:13: error: stray ‘\235’ in program
01LST01.c:16: error: stray ‘\342’ in program
01LST01.c:16: error: stray ‘\200’ in program
01LST01.c:16: error: stray ‘\234’ in program
01LST01.c:16: error: expected expression before ‘%’ token
01LST01.c:16: error: stray ‘\’ in program
01LST01.c:16: error: stray ‘\342’ in program
01LST01.c:16: error: stray ‘\200’ in program
01LST01.c:16: error: stray ‘\235’ in program
01LST01.c:17: error: stray ‘\342’ in program
01LST01.c:17: error: stray ‘\200’ in program
01LST01.c:17: error: stray ‘\234’ in program
01LST01.c:17: error: expected expression before ‘%’ token
01LST01.c:17: error: stray ‘\’ in program
01LST01.c:17: error: stray ‘\342’ in program
01LST01.c:17: error: stray ‘\200’ in program
01LST01.c:17: error: stray ‘\235’ in program
please take a looks at it
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
int
main(int argc,char **argv) {
int z; /* Status return code */
int s[2]; /* Pair of sockets */
/*
* Create a pair of local sockets:
*/
z = socketpair(AF_LOCAL,SOCK_STREAM,0,s);
if ( z == -1 ) {
fprintf(stderr,
“%s: socketpair(AF_LOCAL,SOCK_STREAM,0)\n”,
strerror(errno));
return 1; /* Failed */
}
/*
* Report the socket file descriptors returned:
*/
printf(“s[0] = %d;\n”,s[0]);
printf(“s[1] = %d;\n”,s[1]);
system(“netstat --unix -p”);
return 0;
}
the error returned is ...
cryptid@black-box:~/Socket_sandbox$ gcc -o pro 01LST01.c
01LST01.c: In function ‘main’:
01LST01.c:13: error: stray ‘\342’ in program
01LST01.c:13: error: stray ‘\200’ in program
01LST01.c:13: error: stray ‘\234’ in program
01LST01.c:13: error: expected expression before ‘%’ token
01LST01.c:13: error: stray ‘\’ in program
01LST01.c:13: error: stray ‘\342’ in program
01LST01.c:13: error: stray ‘\200’ in program
01LST01.c:13: error: stray ‘\235’ in program
01LST01.c:16: error: stray ‘\342’ in program
01LST01.c:16: error: stray ‘\200’ in program
01LST01.c:16: error: stray ‘\234’ in program
01LST01.c:16: error: expected expression before ‘%’ token
01LST01.c:16: error: stray ‘\’ in program
01LST01.c:16: error: stray ‘\342’ in program
01LST01.c:16: error: stray ‘\200’ in program
01LST01.c:16: error: stray ‘\235’ in program
01LST01.c:17: error: stray ‘\342’ in program
01LST01.c:17: error: stray ‘\200’ in program
01LST01.c:17: error: stray ‘\234’ in program
01LST01.c:17: error: expected expression before ‘%’ token
01LST01.c:17: error: stray ‘\’ in program
01LST01.c:17: error: stray ‘\342’ in program
01LST01.c:17: error: stray ‘\200’ in program
01LST01.c:17: error: stray ‘\235’ in program