Last change
on this file since db58227 was 7b43385, checked in by dportnoy <dmp1488@…>, 12 years ago |
Smooth player movement now works, albeit poorly.
|
-
Property mode
set to
100644
|
File size:
748 bytes
|
Rev | Line | |
---|
[b53c6b3] | 1 | #include "Message.h"
|
---|
[d87708d] | 2 |
|
---|
[b53c6b3] | 3 | #include "Compiler.h"
|
---|
[d87708d] | 4 |
|
---|
[e084950] | 5 | #if defined WINDOWS
|
---|
[0dde5da] | 6 | #include <winsock2.h>
|
---|
| 7 | #include <WS2tcpip.h>
|
---|
[e084950] | 8 | #elif defined LINUX
|
---|
[0dde5da] | 9 | #include <sys/socket.h>
|
---|
| 10 | #include <netinet/in.h>
|
---|
[d87708d] | 11 | #endif
|
---|
| 12 |
|
---|
[9c83610] | 13 | #include <iostream>
|
---|
| 14 |
|
---|
| 15 | using namespace std;
|
---|
| 16 |
|
---|
[d87708d] | 17 | int sendMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest)
|
---|
| 18 | {
|
---|
[38b85bb] | 19 | int ret = sendto(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)dest, sizeof(struct sockaddr_in));
|
---|
[9c83610] | 20 |
|
---|
[38b85bb] | 21 | return ret;
|
---|
[d87708d] | 22 | }
|
---|
| 23 |
|
---|
| 24 | int receiveMessage(NETWORK_MSG *msg, int sock, struct sockaddr_in *dest)
|
---|
| 25 | {
|
---|
[0dde5da] | 26 | socklen_t socklen = sizeof(struct sockaddr_in);
|
---|
[d87708d] | 27 |
|
---|
[0dde5da] | 28 | // assume we don't care about the value of socklen
|
---|
[38b85bb] | 29 | int ret = recvfrom(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)dest, &socklen);
|
---|
[9c83610] | 30 |
|
---|
[38b85bb] | 31 | return ret;
|
---|
[e084950] | 32 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.