Last change
on this file since d87708d was d87708d, checked in by dportnoy <dmp1488@…>, 12 years ago |
Added a compiler header to determine whether a windows or linux compiler is being used
|
-
Property mode
set to
100644
|
File size:
544 bytes
|
Rev | Line | |
---|
[d87708d] | 1 | #include "message.h"
|
---|
| 2 |
|
---|
| 3 | #include "compiler.h"
|
---|
| 4 |
|
---|
| 5 | #ifdef WINDOWS
|
---|
| 6 | #include <winsock2.h>
|
---|
| 7 | #endif
|
---|
| 8 |
|
---|
| 9 | int sendMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest)
|
---|
| 10 | {
|
---|
| 11 | return sendto(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)dest, sizeof(struct sockaddr_in));
|
---|
| 12 | }
|
---|
| 13 |
|
---|
| 14 | int receiveMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest)
|
---|
| 15 | {
|
---|
| 16 | int socklen = sizeof(struct sockaddr_in);
|
---|
| 17 |
|
---|
| 18 | // assume we don't care about the value of socklen
|
---|
| 19 | return recvfrom(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)dest, &socklen);
|
---|
| 20 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.