Coder Social home page Coder Social logo

Comments (4)

clue avatar clue commented on September 13, 2024

This is also covered by our test suite: https://github.com/reactphp/socket-client/blob/f905ec2a576b1242b10d5c1dbd2f0eb4fcea7f0c/tests/TcpConnectorTest.php#L12-L21

Are you sure there's nothing listening on this port? :-)

$ sudo netstat -tulpn | grep :8080

from socket-client.

cboden avatar cboden commented on September 13, 2024

netstat: n: unknown or uninstrumented protocol

I found the issue however...I have a VirtualBox instance that is forwarding 8080 to a guest OS but the guest OS doesn't have a service listening to the forwarded port. I'm not sure what state the host port is in, but it's not connectable...telnet 127.0.0.1 8080 returns:

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

from socket-client.

clue avatar clue commented on September 13, 2024

it's not connectable
Connected to localhost.
Connection closed by foreign host.

This means the port is in fact open and you just did connect successfully. And after connecting, the server immediately closed your connection.

FWIW: You can also reproduce this with a simple server like this:

$server = new Server($loop);
$server->on('connection', function ($conn) {
    $conn->close();
});
$server->listen(8080);

This behavior is in line with how all low-level socket functions work (socket_connect(), fsockopen(), stream_socket_client() etc.), so I'm all for keeping this as-is.

from socket-client.

cboden avatar cboden commented on September 13, 2024

ugh...I didn't have a close handler in my lib until after the higher level protocol was established...totally missed a close call was being emitted from the stream

from socket-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.