generated from sigonasr2/CPlusPlusProjectTemplate
There's some socket connection stuff in here now. Not too important.
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
63440c5996
commit
b7691a230e
BIN
MeercaChase
BIN
MeercaChase
Binary file not shown.
@ -264,9 +264,11 @@ public:
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
||||||
MeercaChase game;
|
MeercaChase game;
|
||||||
if (game.Construct(WINDOW_WIDTH, WINDOW_HEIGHT, 4, 4))
|
if (game.Construct(WINDOW_WIDTH, WINDOW_HEIGHT, 4, 4))
|
||||||
game.Start();
|
game.Start();
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
File diff suppressed because one or more lines are too long
BIN
MeercaChase.wasm
BIN
MeercaChase.wasm
Binary file not shown.
BIN
MeercaChase.zip
Normal file
BIN
MeercaChase.zip
Normal file
Binary file not shown.
31
socketTest.cpp
Normal file
31
socketTest.cpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#include "pixelGameEngine.h"
|
||||||
|
#include "sys/socket.h"
|
||||||
|
#include "netinet/in.h"
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
void runSocket() {
|
||||||
|
cout << "Connecting.";
|
||||||
|
int sock = socket(AF_INET,SOCK_STREAM,0);
|
||||||
|
if (sock<0) {
|
||||||
|
cout << "Socket connection error.";
|
||||||
|
}
|
||||||
|
struct sockaddr_in addr;
|
||||||
|
addr.sin_family=AF_INET;
|
||||||
|
addr.sin_port=htons(8080);
|
||||||
|
if (inet_pton(AF_INET, "192.168.1.85", &addr.sin_addr)<=0) {
|
||||||
|
cout << "Invalid address";
|
||||||
|
}
|
||||||
|
int client_fd = connect(sock,(struct sockaddr*)&addr,sizeof(addr));
|
||||||
|
if (client_fd<0) {
|
||||||
|
cout << "Failed to connect.";
|
||||||
|
}
|
||||||
|
send(sock,"GET / HTTP/1.1\n",strlen("GET / HTTP/1.1\n"),0);
|
||||||
|
char buffer[1024] = {};
|
||||||
|
while (read(sock,buffer,1024)!=0) {
|
||||||
|
cout << buffer << "\n";
|
||||||
|
}
|
||||||
|
close(client_fd);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user