Click here to Skip to main content
11,580,653 members (70,146 online)
Click here to Skip to main content
Add your own
alternative version

The Differences Between Network Calls in Windows and Linux

, , 29 Dec 2010 CPOL 33.6K 613 86
This article describes the differences in sockets usage under BSD and Windows
Sockets_sample.zip
Example.cc
BSD2WSA.cc
#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.

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.
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 http://www.apriorit.com
Group type: Organisation

32 members


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

You may also be interested in...

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