[SOLVED] enet cannot create any server

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
PGUp
Citizen
Posts: 95
Joined: Fri Apr 21, 2017 9:17 am

[SOLVED] enet cannot create any server

Post by PGUp » Wed Jun 12, 2019 2:02 pm

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?
Last edited by PGUp on Sat Jun 15, 2019 4:42 pm, edited 1 time in total.
-

bobbyjones
Party member
Posts: 712
Joined: Sat Apr 26, 2014 7:46 pm

Re: enet cannot create any server

Post by bobbyjones » 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
Check out my most recent medium post, please give feedback.
Link

PGUp
Citizen
Posts: 95
Joined: Fri Apr 21, 2017 9:17 am

Re: enet cannot create any server

Post by PGUp » 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.
-

dusoft
Citizen
Posts: 95
Joined: Fri Nov 08, 2013 12:07 am

Re: enet cannot create any server

Post by dusoft » 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.

PGUp
Citizen
Posts: 95
Joined: Fri Apr 21, 2017 9:17 am

Re: enet cannot create any server

Post by PGUp » Thu Jun 13, 2019 4:10 am

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
-

User avatar
pgimeno
Party member
Posts: 1629
Joined: Sun Oct 18, 2015 2:58 pm

Re: enet cannot create any server

Post by pgimeno » 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?

PGUp
Citizen
Posts: 95
Joined: Fri Apr 21, 2017 9:17 am

Re: enet cannot create any server

Post by PGUp » Thu Jun 13, 2019 11:33 am

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.
-

User avatar
Karai17
Party member
Posts: 876
Joined: Sun Sep 02, 2012 10:46 pm

Re: enet cannot create any server

Post by Karai17 » 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.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé

PGUp
Citizen
Posts: 95
Joined: Fri Apr 21, 2017 9:17 am

Re: enet cannot create any server

Post by PGUp » Thu Jun 13, 2019 4:52 pm

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.
-

User avatar
pgimeno
Party member
Posts: 1629
Joined: Sun Oct 18, 2015 2:58 pm

Re: enet cannot create any server

Post by pgimeno » Sat Jun 15, 2019 1:14 am

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?

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 6 guests