473,396 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Beginner: Need some help with BSD sockets...

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.

Dec 14 '06 #1
4 1298
an**********@gmail.com wrote:
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-lit...t.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

Dec 14 '06 #2
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.

On Dec 13, 4:25 pm, "mlimber" <mlim...@gmail.comwrote:
antonioet...@gmail.com wrote:
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-lit...t.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
Dec 14 '06 #3

an**********@gmail.com wrote:
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.
>
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.
Dec 14 '06 #4
Yup, thats what the people at unix programming told me. It compiles
perfectly now. Thanks for the input =)

Salt_Peter wrote:
an**********@gmail.com wrote:
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.

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.
Dec 17 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: mrpolitics | last post by:
So I'm working with PureIRCD (http://sourceforge.net/projects/pure-ircd) and everything was fine untill yesterday when the server crashed. So I did a cold restart and staretd the server back up...
4
by: Emilio | last post by:
In the help pages for the UdpClient there is some sample code which sends a udp message and prints what it received. Can someone help me to finish the code present there? I think basically the...
3
by: Winston Nimchan | last post by:
Hi: I would like to build a socket server application that is user configurable using XML (app.config) and would like some guidance. I already have a single socket server working but would...
1
by: hamil | last post by:
I am having trouble using the TcpListener and TcpClient classes. At the end of this post is server code that runs, and a class whose purpose is described below. I need to know when the client...
0
by: Eternal Snow | last post by:
Hello. I have some trouble. Please look at this code below written in VB2005 (.net 2 50727). Sub Main() Dim osck As Net.Sockets.Socket Dim datagram() As Byte = {69, 0, 0, 52, 108, 180, 0, 0,...
12
by: manochavishal | last post by:
Hi, I am having strange problem in my Program. I cannot paste the whole program as it is huge so just pasting the lines i think are necessary. I am passing a integer array pointer to a...
29
by: pencilneck | last post by:
yes, i'm reading the book "practical c programming" and going along on my own trying to learn c. i know the basics of programming, but there seem to be some idiosyncracies in c that i don't...
0
by: Rambaldi | last post by:
Hi there, I can connect to the WebMethod from the WM6 emulator, but i cant connect from the device :S Shouldnt the device work as fine as the Emulator??? I change the web reference url to my...
22
by: ddg_linux | last post by:
I have been reading about and doing a lot of php code examples from books but now I find myself wanting to do something practical with some of the skills that I have learned. I am a beginner php...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.