64 lines
1.3 KiB
C
64 lines
1.3 KiB
C
#include "server.h"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include "transactions.h"
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
#include "../game_source/vector.h"
|
|
#include <time.h>
|
|
|
|
|
|
void Vec2Transacgtion(user_transaction* t, vec2* v) {
|
|
memcpy(v, t->userArg, t->argsize);
|
|
}
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
s_game_server s;
|
|
memset(&s,0,sizeof(s));
|
|
int serverEnd = 0;
|
|
|
|
user_transaction st1;
|
|
user_transaction st2;
|
|
user_transaction rst1;
|
|
user_transaction rst2;
|
|
memset(&st1,0,sizeof(st1));
|
|
memset(&st2,0,sizeof(st2));
|
|
memset(&rst1,0,sizeof(rst1));
|
|
memset(&rst2,0,sizeof(rst2));
|
|
vec2 pos = {10,10};
|
|
struct timespec last_time;
|
|
clock_gettime(CLOCK_MONOTONIC,&last_time);
|
|
|
|
st1 = (user_transaction){
|
|
.userArg = &pos,
|
|
.action = 1,
|
|
.id = SERVER_T_USER_FLAG,
|
|
.argsize = 8,
|
|
};
|
|
st2 = (user_transaction){
|
|
.userArg = &pos,
|
|
.action = 1,
|
|
.id = SERVER_T_USER_FLAG,
|
|
.argsize = 8,
|
|
};
|
|
|
|
start_server(&s);
|
|
do {
|
|
int new_client = 0;
|
|
if((new_client = accept_client(&s)) > 0) {
|
|
printf("connection!\n");
|
|
//if(get_player_data(&s,new_client)) {
|
|
// close(new_client);
|
|
//}
|
|
//
|
|
}
|
|
|
|
}while(!serverEnd);
|
|
|
|
|
|
|
|
return 0;
|
|
}
|