I'm learning socket programming on Linux. I have some questions what I would like to ask. I hope you will help me!
That's why, that I'm new to Network Programming, I like to keep things simple.
When I use connect();, I need to connect like this:
Why can't I use connect like this?Code:connect(fd, (struct sockaddr *)&server, sizeof(struct sockaddr));
Why can't I just type IP address there, instead of (struct sockaddr *)&server. And what is that sizeof(struct sockaddr) thing? Why do I need it? Now for the server part. When making server, I need to declare this:Code:connect(fd, "220.127.116.11", sizeof(struct sockaddr));
And do this:Code:socklen_t sin_size;
And in the end, after socket(); bind(); listen(); I need to accept(); Why does accept need this sin_size as an argument? Is it posible to make Networking app's, without using structures(sockaddr_in or others)?Code:sin_size=sizeof(struct sockaddr_in);