Click here to Skip to main content
12,954,856 members (66,922 online)
Click here to Skip to main content


89 bookmarked
Posted 28 Dec 2010

The Differences Between Network Calls in Windows and Linux

, , 29 Dec 2010 CPOL
This article describes the differences in sockets usage under BSD and Windows
#pragma once

#include <map>
#include <sys/types.h>

#include "WSATypes.h"

namespace BSD2WSA
//socket types converting

class SocketsStorage
public :
    bool hasSocket(int const fd);
    int addSocket(SOCKET const handle);
    void removeSocket(int const fd);
    SOCKET convert(int const fd);
    int convert(SOCKET const handle);
private :
    typedef std::map<int, SOCKET> sockets_map;
    sockets_map map_;
//constants converting
void select2WSASelect(fd_set *bsd, fd_set_ *win, sockets_map &sockets);
void WSASelect2select(fd_set_ *win, fd_set *bsd, sockets_map &sockets);
int WSA2errno(int const WSA);
int domain2WSAdomain(int domain);
int WSAdomain2domain(int domain);
void WSA2sockopt(int *level, int *option);
void sockopt2WSA(int *level, int *option);
short WSAPoll2poll(short const flags);
short poll2WSAPoll(short const flags);
int msgFlags2WSAmsgFlags(int flags);
int WSAmsgFlags2msgFlags(int flags);

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.


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


About the Authors

Apriorit Inc
Apriorit Inc.
Hungary Hungary
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
Group type: Organisation

32 members

Anthony Shoumikhin
Software Developer Google
United States United States
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170525.1 | Last Updated 30 Dec 2010
Article Copyright 2010 by Apriorit Inc, Anthony Shoumikhin
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid