+ 4

Struct in c++

Edit: i just learning socket for c++ from http://www.bogotobogo.com/cplusplus/sockets_server_client.php in bind function, the second argument is (struct socaddr *) server_addr. what is that? how is it possible struct is in argument? i confuse. what i know, the difference between class and struct is struct automatically public for all member

21st Apr 2018, 1:55 AM
Kevin AS
Kevin AS - avatar
3 Antworten
+ 4
i will learn more of them. thanks for you guys for the hint
21st Apr 2018, 4:43 AM
Kevin AS
Kevin AS - avatar
+ 3
@<p> Kevin</p> the link is invalid my friend, I got error 404 for that link, server down? If I'm not mistaken it means the server_addr will be casted into a pointer of a structure of sockaddr, which then can be accessed like an object (structures has members like classes) with arrow member access (->). http://man7.org/linux/man-pages/man2/bind.2.html Sorry I can't help much, haven't learned socket yet, and if my answer is incorrect please notify so I can fix it : )
21st Apr 2018, 3:46 AM
Ipang
+ 3
@Gordie, Thanks for coming in, I couldn't explain it thoroughly so a link was given, I'll be standing by ... : )
21st Apr 2018, 4:24 AM
Ipang