Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I have a very interesting problem while making a simple client server program in c. i am wokring on linux kernel-184.108.40.206 . While creating a socket for my server program i want to bind it with a port. for which i used following code
struct sockaddr_in sad;
memset((char *)&sad,0,sizeof(sad)); /* clear sockaddr structure */
sad.sin_family = AF_INET; /* set family to Internet */
sad.sin_addr.s_addr = INADDR_ANY; /* set the local IP address */
sad.sin_port = htons((u_short)port);/* set the port number */
now i want to extract all the members of structure b .. but i am getting incompatible reference pointer error. I just want to typecats a struct sockaddr into sockaddr_in and extract all of its data members. Please help me.