Page 1 of 1

Grease/ENET not working

Posted: Sun Jul 10, 2016 5:06 pm
by Substance12
I've been messing around with Grease and I got both a TCP and UDP client/server working, but I can't manage to get it's ENET implementation working. A code as simple as this:

Code: Select all

server = grease.udpServer()

        server.handshake = "handshake"
        server:setPing()
        server:listen(1337)

Code: Select all

client = grease.udpClient()

        client.handshake = "handshake"
        client:setPing()
        client:connect("localhost", 1337)
Plus the update(dt) functions, will work perfectly, but the ENET implementations (enetClient and enetServer) won't work at all. The client just won't connect and I have no idea why. I have looked onto other ENET examples and they all seem to be basically the same...

Re: Grease/ENET not working

Posted: Sun Jul 10, 2016 6:11 pm
by bartbes
What are the return values of connect? Does it indicate an error?

Re: Grease/ENET not working

Posted: Sun Jul 10, 2016 6:18 pm
by Substance12
Ah, yes, it returns err, "Could not connect"

Re: Grease/ENET not working

Posted: Sun Jul 10, 2016 6:35 pm
by bartbes
Unfortunately enet doesn't really seem to provide any information as to why this is happening. Do you launch the server before the client? Is something else using udp port 1337, or has it in the last few minutes?

Re: Grease/ENET not working

Posted: Sun Jul 10, 2016 6:52 pm
by Substance12
Yeah, server is launched before the client. I have tried switching the update(dt) functions so the server updates before the client and vice versa but I get the same result.

I used netstat and noticed that the 1337 port is used both with an UDP and ENET server when the game is launched, so, at least the server works.