Beginner: Need some help with BSD sockets...

A

antonioetayo

Heres the code:
http://www.pastebin.co.uk/7303

When I try to compile in debian using g++ I get this error:

network_module_server.cpp: In function `int main()':
network_module_server.cpp:54: error: invalid conversion from `int*' to
`
socklen_t*'
network_module_server.cpp:61: error: parse error before `,' token



I have no idea what the heck is going on. I'm following this tutorial
almost to the letter:
http://beej.us/guide/bgnet/output/html/syscalls.html

Check on the accept() section. And yeah, I know theres a lot possibly
unnecessary comments in the code and whatnot but thats my way of
keeping notes while I learn.


PS: If you know of a better tutorial/book on the subject, please
enlighten me.
 
M

mlimber

Heres the code:
http://www.pastebin.co.uk/7303

When I try to compile in debian using g++ I get this error:

network_module_server.cpp: In function `int main()':
network_module_server.cpp:54: error: invalid conversion from `int*' to
`
socklen_t*'
network_module_server.cpp:61: error: parse error before `,' token



I have no idea what the heck is going on. I'm following this tutorial
almost to the letter:
http://beej.us/guide/bgnet/output/html/syscalls.html

Check on the accept() section. And yeah, I know theres a lot possibly
unnecessary comments in the code and whatnot but thats my way of
keeping notes while I learn.


PS: If you know of a better tutorial/book on the subject, please
enlighten me.

I think you want comp.unix.programming, comp.os.linux.networking, or
similar. See this FAQ for what is on-topic here:

http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.9

Alternately, if you can rephrase your question in terms of standard
C++, we may be able to help further.

Cheers! --M
 
A

antonioetayo

Well since I'm writing in C++ I figured this was the right place to
ask. I'll try in a Unix group then.

Thanks anyway.
 
S

Salt_Peter

Heres the code:
http://www.pastebin.co.uk/7303

When I try to compile in debian using g++ I get this error:

network_module_server.cpp: In function `int main()':
network_module_server.cpp:54: error: invalid conversion from `int*' to
`
socklen_t*'
network_module_server.cpp:61: error: parse error before `,' token

try:
socklen_t address_length;
instead of
int address_length;

If i remember correctly, some platforms define socklen_t to be unsigned
rather than your everyday integer.
 
A

antonioetayo

Yup, thats what the people at unix programming told me. It compiles
perfectly now. Thanks for the input =)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top