View Single Post
  #1 (permalink)  
Old March 6th, 2007, 01:24 PM
octavius octavius is offline
Registered User
Join Date: Mar 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default broken pipe error in implementing client -server

i am new to socket programming...when i was trying the code given in the book for client-server model using socket programming, i faced a broken pipe error in the server program

int main()
{ int sockfd;
        int len;
        struct sockaddr_un address;
        int result;
        char ch='A';



        result=connect(sockfd,(struct sockaddr *)&address,len);
        { perror("oops:client");

        printf("char from server=%c\n",ch);

int main()
        int server_sockfd,client_sockfd;
        int server_len,client_len;
        struct sockaddr_un server_address;
        struct sockaddr_un client_address;
        char ch;


        bind(server_sockfd,(struct sockaddr *)&server_address,server_len);
        { printf("server waiting\n");
                client_sockfd=accept(server_sockfd,(struct sockaddr *)&client_address,(socklen_t *)&client_len);

when i run server in the background i get
server waiting

after this when i run client i get
[1]+ Broken pipe ./server

i am not being able to figure the error...plz help