Best language for socket programming

Status
Not open for further replies.
OP
C

cryptid

Journeyman
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
 

Faun

Wahahaha~!
Staff member
its the "quotes and ticks" problem which happens while copying from ebooks
lolz...noob
 

Faun

Wahahaha~!
Staff member
^^you sure its not double quotes ?

"quotes and ticks is a general name to this problem coined by neo darwin"
lolz
 
Last edited:

ray|raven

Think Zen.
Oh noes, its turning into a language war!

Die QwertyM for starting a language war :p

+1 more for Java...

BTW, whats SWT ray|raven ?? Do u mean AWT ?? And if it is AWT, then instead of that, use Swing which is more advanced ! :p

Like Chandru.in said , its another gui toolkit for Java.
The advantage over Swing is that , SWT lets the native system draw the widgets , so they're faster than swing widgets , and the look-n-feel is consistent. It also takes away some load from the JVM i guess.

The disadvantage is that , you gotta compile each platform's version with a compatible version of SWT.
 
Last edited:
Status
Not open for further replies.
Top Bottom