Changeset 5e693e8 in network-game for common/message.cpp


Ignore:
Timestamp:
Nov 24, 2012, 2:48:40 PM (12 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
94ebbd9
Parents:
e08572c
git-author:
dportnoy <dmp1488@…> (11/24/12 14:11:41)
git-committer:
dportnoy <dmp1488@…> (11/24/12 14:48:40)
Message:

Added a makefile for the client and made the WSA functions only work on Windows platforms

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/message.cpp

    re08572c r5e693e8  
    44
    55#if defined WINDOWS
    6         #include <winsock2.h>
    7         #include <WS2tcpip.h>
     6   #include <winsock2.h>
     7   #include <WS2tcpip.h>
    88#elif defined LINUX
    9         #include <sys/socket.h>
    10         #include <netinet/in.h>
     9   #include <sys/socket.h>
     10   #include <netinet/in.h>
    1111#endif
    1212
    1313int sendMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest)
    1414{
    15         return sendto(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)dest, sizeof(struct sockaddr_in));
     15   return sendto(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)dest, sizeof(struct sockaddr_in));
    1616}
    1717
    1818int receiveMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest)
    1919{
    20         socklen_t socklen = sizeof(struct sockaddr_in);
     20   socklen_t socklen = sizeof(struct sockaddr_in);
    2121
    22         // assume we don't care about the value of socklen
    23         return recvfrom(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)dest, &socklen);
     22   // assume we don't care about the value of socklen
     23   return recvfrom(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)dest, &socklen);
    2424}
Note: See TracChangeset for help on using the changeset viewer.