Computing.Net > Forums > Programming > C sockaddr_in

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

C sockaddr_in

Reply to Message Icon

Name: wille
Date: January 10, 2009 at 17:45:44 Pacific
OS: Microsoft Windows Vista Home Premium
CPU/Ram: 2 GHz DualCore/ 2041 MB
Product: Lenovo / 42334dg
Subcategory: C/C++
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: klint
Date: January 11, 2009 at 17:06:48 Pacific
Reply:

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.


0

Response Number 2
Name: wille
Date: January 11, 2009 at 17:55:15 Pacific
Reply:

Yeah that worked, thanks very much!

Live the life as you know it
/ Wille


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Posting code.. MSWord VBA



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: C sockaddr_in

C++ HELP - symbol reference errors www.computing.net/answers/programming/c-help-symbol-reference-errors/17051.html

c++ source www.computing.net/answers/programming/c-source/9333.html

C compiler problem www.computing.net/answers/programming/c-compiler-problem/4363.html