Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

The Differences Between Network Calls in Windows and Linux

, , 29 Dec 2010
This article describes the differences in sockets usage under BSD and Windows
Sockets_sample.zip
Example.cc
BSD2WSA.cc
#include <sys/types.h>

namespace redirected
{
//==================================================================================================
int socket(int domain, int type, int protocol);
int getsockopt(int sockfd, int level, int option_name, void *option_value, socklen_t *option_len);
int setsockopt(int sockfd, int level, int option_name, void const *option_value, socklen_t option_len);
int bind(int sockfd, struct sockaddr const *address, socklen_t addrlen);
int connect(int sockfd, sockaddr const *address, socklen_t addrlen);
int poll(struct pollfd *fds, nfds_t nfds, int timeout);
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout);
int getsockname(int sockfd, struct sockaddr *address, socklen_t *addrlen);
int getpeername(int sockfd, struct sockaddr *address, socklen_t *addrlen);
int getaddrinfo(char const *node, char const *service, struct addrinfo const *hints, struct addrinfo **res);
ssize_t recv(int sockfd, void *buffer, size_t length, int flags);
ssize_t recvfrom(int sockfd, void *buffer, size_t length, int flags, struct sockaddr *from, socklen_t *fromlen);
ssize_t send(int sockfd, void const *buffer, size_t length, int flags);
ssize_t sendto(int sockfd, void const *buffer, size_t length, int flags, struct sockaddr const *to, socklen_t tolen);
int fcntl(int fd, int cmd, ...);
int ioctl(int fd, int cmd, ...);
int shutdown(int sockfd, int how);
int close(int fd);
//==================================================================================================
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Authors

Apriorit Inc
Apriorit Inc.
Ukraine Ukraine
ApriorIT is a Software Research and Development company that works in advanced knowledge-intensive scopes.
 
Company offers integrated research&development services for the software projects in such directions as Corporate Security, Remote Control, Mobile Development, Embedded Systems, Virtualization, Drivers and others.
 
Official site http://www.apriorit.com
Group type: Organisation

31 members

Follow on   LinkedIn

Anthony Shoumikhin
Software Developer Microsoft
United States United States
No Biography provided
Follow on   Twitter

| Advertise | Privacy | Mobile
Web04 | 2.8.140922.1 | Last Updated 30 Dec 2010
Article Copyright 2010 by Apriorit Inc, Anthony Shoumikhin
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid