There's some socket connection stuff in here now. Not too important.

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 63440c5996
commit b7691a230e
  1. BIN
      MeercaChase
  2. 2
      MeercaChase.cpp
  3. 2
      MeercaChase.js
  4. BIN
      MeercaChase.wasm
  5. BIN
      MeercaChase.zip
  6. 31
      socketTest.cpp

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

Binary file not shown.

Binary file not shown.

@ -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…
Cancel
Save