C sockaddr_in

Lenovo / 42334dg
January 10, 2009 at 17:45:44
Specs: Microsoft Windows Vista Home Premium, 2 GHz DualCore/ 2041 MB
Hello, if the subject wasn't clear, I have a problem with winsock using the c language. I have a server and client(TCP) written in c but it doesn't like the
sockaddr_in service;
and
sockaddr_in clientservice;
statements.
If I compile it in c++ it runs, not giving any errors about this.
I believe the error to be that the compiler can not find a reference to sockaddr_in, and can therefor not recognize it.
Any thoughts about this?
Thanks in advance.

Live the life as you know it
/ Wille


See More: C sockaddr_in

Report •


#1
January 11, 2009 at 17:06:48
Have a look at the winsock header file. You'll find sockaddr_in is a struct. Therefore in C (but not C++) you need to say

struct sockaddr_in service;

But you'll probably find there is also a suitable typedef you can use instead of sockaddr_in.


Report •

#2
January 11, 2009 at 17:55:15
Yeah that worked, thanks very much!

Live the life as you know it
/ Wille


Report •

Related Solutions


Ask Question