![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| IP Networking Learn TCP/IP, Internet Protocol, Routing, Routers, Network protocols in this UNIX and Linux forum. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| reverse an integer | ali560045 | Shell Programming and Scripting | 4 | 05-20-2008 04:15 AM |
| Cannot store integer value | bennichan | Shell Programming and Scripting | 5 | 04-10-2008 03:20 PM |
| get integer part | ericaworld | Shell Programming and Scripting | 3 | 05-29-2007 04:16 PM |
| pf not working properly even with only "pass in all" and "pass out all" rules | xyyz | UNIX for Advanced & Expert Users | 4 | 12-30-2003 05:33 AM |
| integer arrays | primal | High Level Programming | 4 | 03-09-2002 05:40 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
how to pass integer
i am writing a client and server program
client program main() { int sockfd,n; char str[20]; struct sockaddr_in sock; if ((sockfd=socket(AF_INET,SOCK_STREAM,0))<0) { perror("SOCKET ERROR"); } bzero(&sock,sizeof(sock)); sock.sin_family=AF_INET; sock.sin_port=7500; sock.sin_addr.s_addr=inet_addr("192.127.137.251"); if(connect(sockfd,(struct sockaddr*)&sock,sizeof(sock))<0) { perror("CONNECT ERROR :"); } strcpy(str,"i am here"); write(sockfd,(char *)str,strlrn(str)+1); //close(sockfd); socket program main() { int sockfd,connfd,clientlen; char str[20]; struct sockaddr_in sock,client; if((sockfd=socket(AF_INET,SOCK_STREAM,0))<0) { perror("SOCKET ERROR "); } bzero(&sock,sizeof(sock)); sock.sin_family=AF_INET; sock.sin_port=7500; sock.sin_addr.s_addr=inet_addr("192.127.137.251"); if((bind(sockfd,(struct sockaddr*)&sock,sizeof(sock)))<0) { perror("BIND ERROR:"); } listen(sockfd,3); clientlen=sizeof(client); if((connfd=accept(sockfd,(struct sockaddr*)&client,&clientlen))<0) { perror("CONNECTION ERROR :"); } read(connfd,(char *)str,20); printf("%s ",str); close(connfd); close(sockfd); } now the problem is i have to pass a integer or bool variable rather than string how can i do this |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|