Jump to content

Recommended Posts

Posted

Hey, so I am trying to do TCP Requests.


A older post here mentioned including "socket" or "luasocket", but it seems like these modules are not found.

 

This is some code I tried:

 

local socket = require("socket")

-- Define the server's IP address and port
local serverIP = "192.168.100.15"
local serverPort = 16427

-- Create a TCP socket
local client = socket.tcp()

-- Connect to the server
client:connect(serverIP, serverPort)

-- Send data to the server
local messageToSend = "Hello, server!"
client:send(messageToSend)

-- Receive data from the server
local receivedData, err = client:receive()
if receivedData then
    print("Received data from server: " .. receivedData)
else
    print("Error while receiving data: " .. err)
end

-- Close the connection
client:close()

 

Posted

C Module like luasocket are not available on game guardian see the API for available method 

Posted

There is no TCP api here, only some HTTP methods which are way slower than TCP and I cannot use it reliably in my project

Posted

[ @Bloxxy ]
---
Lua that's bundled inside Game Guardian cannot use external module and even some Lua internal modules. But, Game Guardian do support HTTP bequest, so your server needs to also support HTTP/HTTPS protocol, otherwise there's nothing you can do about it. Yes, even plain TCP aren't do-able.
---
See request documentation: gg.makeRequest

Posted

How cannot Game Guardian use external modules? I can use require for Lua modules just fine, not C though.

 

Http is too slow in my case, I need to deliver 500 bytes and HTTP adds a 200 bytes overhead. I am running the server on a computer above the VM, but technically that still gets into the network, getting a 2ms additional delay, and HTTP makes a new socket for every request making it way too slow for my needs. Why are simple features that are needed like TCP excluded?

Posted

[ @Bloxxy ]
---

Quote

I can use require for Lua modules just fine

Yes, I mean it as partially.
---

Quote

HTTP makes a new socket for every request making it way too slow for my needs

You can re-use existing socket by using HTTP Pipelining: See

GET / HTTP/1.1\r\n
Host: blah.com\r\n
\r\n
GET / HTTP/1.1\r\n
Host: blah.com\r\n
\r\n

---

Quote

I need to deliver 500 bytes and HTTP adds a 200 bytes overhead

200 bytes for headers, etc; is not a lot and still reasonable.
---

Posted
On 8/21/2023 at 7:27 PM, Xaviesz said:

[ @Bloxxy ]
---

Yes, I mean it as partially.
---

You can re-use existing socket by using HTTP Pipelining: See

GET / HTTP/1.1\r\n
Host: blah.com\r\n
\r\n
GET / HTTP/1.1\r\n
Host: blah.com\r\n
\r\n

---

200 bytes for headers, etc; is not a lot and still reasonable.
---

HTTP standard on the exact same page you posted says that you should not use pipelining on post requests, and even if that's possible it would make a 4x delay from 5ms to 20ms if I combine 4 posts.

 

And 200 is a lot, it's almost 45% useless data that doesn't help me and just makes the response harder to parse

Posted

[ @Bloxxy ]
---

Quote

even if that's possible it would make a 4x delay from 5ms to 20ms

Welp, I can only suggest you some workaround using HTTP. I don't even know How Game Guardian lua's handle HTTP/2 or HTTP/3. You might need to use HTTP/2 Multiplexing or take care of HTTP/3 which use UDP (Quic) which make it more reasonably faster if you care about connection speed. Connection speed involve many factor and not just at protocol perspective (using CDN for example).
---
Second suggestion is to get your-self multipart body, this will avoids your sended data to be encoded first (\0x88\xblah), less hassle into connection speed.
---
Third, switching protocol to Websocket from HTTP/1. I don't know how Game Guardian handles this but you can switch HTTP/1 to Websocket using this Headers:

Quote

Upgrade: websocket\r\nSec-Websocket-Version: 13\r\n\r\n

---
That's pretty much wraps any ideas I would have. It is very limited, you might find yourself using another way instead of doing it inside Game Guardian. 

Posted
9 hours ago, Xaviesz said:

[ @Bloxxy ]
---

Welp, I can only suggest you some workaround using HTTP. I don't even know How Game Guardian lua's handle HTTP/2 or HTTP/3. You might need to use HTTP/2 Multiplexing or take care of HTTP/3 which use UDP (Quic) which make it more reasonably faster if you care about connection speed. Connection speed involve many factor and not just at protocol perspective (using CDN for example).
---
Second suggestion is to get your-self multipart body, this will avoids your sended data to be encoded first (\0x88\xblah), less hassle into connection speed.
---
Third, switching protocol to Websocket from HTTP/1. I don't know how Game Guardian handles this but you can switch HTTP/1 to Websocket using this Headers:

---
That's pretty much wraps any ideas I would have. It is very limited, you might find yourself using another way instead of doing it inside Game Guardian. 

I would prefer not using UDP, since I need all the packets to arrive (and in the order sent).

 

Switching to Websocket mode is useless, since Game Guardian closes the TCP remote instantly after sending the message, so it's like making a Websocket but not sending any data and closing it instantly.

 

I wonder why this popular modding application misses the most important feature any application should have

Posted (edited)

[ @Bloxxy ]
---

Quote

I would prefer not using UDP, since I need all the packets to arrive (and in the order sent).

Quic is build on top of UDP but it doesn't make it a Lossless protocol. Even though the UDP itself is unreliable and lossless but Quic is different, it is reliable, accurate and sure is fast. It is behaving like TCP but on top of UDP. There's a reason Google implemented this.
---

Quote

I wonder why this popular modding application misses the most important feature any application should have

Game Guardian is not a packet oriented application, it's only focusing on what memory debugging should have. I believe gg.makeRequest() is only added just for the shake of Lua extension support.
---

Edited by Xaviesz

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.