summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-05-07 21:36:45 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-05-07 21:36:45 +0000
commit8ec687b21a279d9156a0e02c82f3feee265f8a1a (patch)
tree912b60688be89b97f764ff73a90fc448805bc48b /src/client.cpp
parentaede3ee7379be250a538c31f03f2a922846760fb (diff)
downloadmanaserv-8ec687b21a279d9156a0e02c82f3feee265f8a1a.tar.gz
manaserv-8ec687b21a279d9156a0e02c82f3feee265f8a1a.tar.bz2
manaserv-8ec687b21a279d9156a0e02c82f3feee265f8a1a.tar.xz
manaserv-8ec687b21a279d9156a0e02c82f3feee265f8a1a.zip
Committed client to be used for testing.
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/client.cpp b/src/client.cpp
new file mode 100644
index 00000000..99b1e3dd
--- /dev/null
+++ b/src/client.cpp
@@ -0,0 +1,41 @@
+#include <SDL.h>
+#include <SDL_net.h>
+#include <stdlib.h>
+
+int main(int argc, char *argv[])
+{
+ // Initialize SDL
+ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) == -1) {
+ printf("SDL_Init: %s\n", SDL_GetError());
+ exit(1);
+ }
+
+ // Set SDL to quit on exit
+ atexit(SDL_Quit);
+
+ // Initialize SDL_net
+ if (SDLNet_Init() == -1) {
+ printf("SDLNet_Init: %s\n", SDLNet_GetError());
+ exit(2);
+ }
+
+ // Try to connect to server
+ IPaddress ip;
+ TCPsocket tcpsock;
+
+ if (SDLNet_ResolveHost(&ip, "localhost", 9601) == -1) {
+ printf("SDLNet_ResolveHost: %s\n", SDLNet_GetError());
+ exit(1);
+ }
+
+ tcpsock = SDLNet_TCP_Open(&ip);
+ if (!tcpsock) {
+ printf("SDLNet_TCP_Open: %s\n", SDLNet_GetError());
+ exit(2);
+ }
+
+ printf("Succesfully connected!\n");
+ SDLNet_TCP_Close(tcpsock);
+
+ return 0;
+}