Page 1 of 2

[SOLVED] enet cannot create any server

Posted: Wed Jun 12, 2019 2:02 pm
by PGUp

Code: Select all

enet = require 'enet'
function love.load()
host = enet.host_create("192.16.100.7:6789")
end

function love.update()
event = host:service(100)

event = host:service()
end
the host is nil, what do? any suggestions?

Re: enet cannot create any server

Posted: Wed Jun 12, 2019 2:23 pm
by bobbyjones
Your ip address and port combo is causing host_create to fail. If you use 127.0.0.1:8888 as the ip port combo it will work

Re: enet cannot create any server

Posted: Wed Jun 12, 2019 5:25 pm
by PGUp
bobbyjones wrote: Wed Jun 12, 2019 2:23 pm Your ip address and port combo is causing host_create to fail. If you use 127.0.0.1:8888 as the ip port combo it will work
the ip of 127.0.0.1 is the same as localhost, I'm not planning to use a localhost server, I want to connect multiple devices together.

Re: enet cannot create any server

Posted: Wed Jun 12, 2019 8:54 pm
by dusoft
PGUp wrote: Wed Jun 12, 2019 5:25 pm
bobbyjones wrote: Wed Jun 12, 2019 2:23 pm Your ip address and port combo is causing host_create to fail. If you use 127.0.0.1:8888 as the ip port combo it will work
the ip of 127.0.0.1 is the same as localhost, I'm not planning to use a localhost server, I want to connect multiple devices together.
Yes, but you should be creating host at the local address (localhost) and only then use the local 192.168.x.x (or WAN external) address from the other devices.

Re: enet cannot create any server

Posted: Thu Jun 13, 2019 4:10 am
by PGUp
dusoft wrote: Wed Jun 12, 2019 8:54 pm
PGUp wrote: Wed Jun 12, 2019 5:25 pm
bobbyjones wrote: Wed Jun 12, 2019 2:23 pm Your ip address and port combo is causing host_create to fail. If you use 127.0.0.1:8888 as the ip port combo it will work
the ip of 127.0.0.1 is the same as localhost, I'm not planning to use a localhost server, I want to connect multiple devices together.
Yes, but you should be creating host at the local address (localhost) and only then use the local 192.168.x.x (or WAN external) address from the other devices.
a localhost can only be created and connected through the same machine, other devices wont connect to a localhost, that's why it is called localhost. I want other devices to connect, not only mine

Re: enet cannot create any server

Posted: Thu Jun 13, 2019 10:59 am
by pgimeno
Is that IP available on your machine? Is the port available? Are you using a firewall?

Does 0.0.0.0 work as an IP?

Re: enet cannot create any server

Posted: Thu Jun 13, 2019 11:33 am
by PGUp
pgimeno wrote: Thu Jun 13, 2019 10:59 am Is that IP available on your machine? Is the port available? Are you using a firewall?

Does 0.0.0.0 work as an IP?
yeah, localhost, localhost ip, 0.0.0.0 ip works, but any other ip wont workm I've tried multiple different ip and ports, none of it works, random ip or ports dont work, i tried ipconfig command in cmd, there is no ethernet local area network thing there. I googled for a while but i cant find any fix for it, my pc is connected to my router.

Re: enet cannot create any server

Posted: Thu Jun 13, 2019 1:39 pm
by Karai17
You're misunderstanding. The server does not care what the ip address is, only clients trying to connect care. the system hosting a server will always be localhost, thus you shoudl put localhost or 127.0.0.1 as the ip address, and then from the system trying to connect to the server, you'd use your 192 address assuming you are connecting from a separate system on your LAN. If you are connecting from the same machine you are hosting, you want to connect with localhost as well. If you want to connect from the Internet, you'd need to connect with your WAN address.

Re: enet cannot create any server

Posted: Thu Jun 13, 2019 4:52 pm
by PGUp
Karai17 wrote: Thu Jun 13, 2019 1:39 pm You're misunderstanding. The server does not care what the ip address is, only clients trying to connect care. the system hosting a server will always be localhost, thus you shoudl put localhost or 127.0.0.1 as the ip address, and then from the system trying to connect to the server, you'd use your 192 address assuming you are connecting from a separate system on your LAN. If you are connecting from the same machine you are hosting, you want to connect with localhost as well. If you want to connect from the Internet, you'd need to connect with your WAN address.

Just tried this, doesnt work, no error. I put localhost as the ip on the server and connect to 192.168.100.7 and 192.168.100.1 on the client, same port, doesnt work.

Re: enet cannot create any server

Posted: Sat Jun 15, 2019 1:14 am
by pgimeno
127.0.0.1 is not supposed to work. Binding to localhost prevents external connections. That's a frequently used security tightening for stuff that supports TCP/IP but is not desired to be contacted from the outside (pretty common with MySQL, for example).

However, 0.0.0.0 should listen on all interfaces, including localhost AND all external ones.

I think in Windows you use ipconfig /all to see all available IPs.

You didn't answer my other questions. Is that IP available on your machine? Is the port available? Are you using a firewall?