my following program runs successfully on linux server but when i want compile/run this program on windows machine using ssh client it doesn't works ...
the errors occurs in including header files. can any one help me on this..
it's really very urgent
code:
Code:/* Make the necessary includes and set up the variables. */ #include <sys/types.h> #include <sys/socket.h> #include <stdio.h> #include <sys/un.h> #include <unistd.h> int main() { int sockfd; int len; struct sockaddr_un address; int result; char ch = 'A'; /* Create a socket for the client. */ sockfd = socket(AF_UNIX, SOCK_STREAM, 0); /* Name the socket, as agreed with the server. */ address.sun_family = AF_UNIX; strcpy(address.sun_path, "server_socket"); len = sizeof(address); /* Now connect our socket to the server's socket. */ result = connect(sockfd, (struct sockaddr *)&address, len); if(result == -1) { perror("oops: client1"); exit(1); } /* We can now read/write via sockfd. */ write(sockfd, &ch, 1); read(sockfd, &ch, 1); printf("char from server = %c\n", ch); close(sockfd); exit(0); }



LinkBack URL
About LinkBacks


