Rapsssito / react-native-tcp-socket

React Native TCP socket API for Android, iOS & macOS with SSL/TLS support.
MIT License
304 stars 80 forks source link

Error: Binding socket to network 103 failed: EPERM (Operation not permitted) #108

Closed ksetrin closed 3 years ago

ksetrin commented 3 years ago

Description

Error: Binding socket to network 103 failed: EPERM (Operation not permitted)

Steps to reproduce

Steps to reproduce the behavior:

  1. Try to connect
        socket = new net.Socket();
        socket.connect(
          {
            port: PORT,
            host: HOST,
            reuseAddress: true,
            interface: 'wifi',
          },
        );
        socket.on('error', console.log);

Current behavior

I'm trying to connect to socket but I'm catching the error It happens only when I try on device, with emulator it works fine

Relevant information

OS: android react-native: 0.63.4 react-native-tcp-socket: 5.2.0

Rapsssito commented 3 years ago

@ksetrin, what Android device are you using?

ksetrin commented 3 years ago

@ksetrin, what Android device are you using?

Redmi 4 MIUI Global 9.5 Android 6.0.1 MMB29M

Rapsssito commented 3 years ago

@ksetrin, are you using a port under 1024?

ksetrin commented 3 years ago

@ksetrin, are you using a port under 1024?

yes, I use 8080

Rapsssito commented 3 years ago

@ksetrin, check if that port is not already been used by other service.

traviswsims commented 3 years ago

I have the same problem, however removing the interface: 'wifi' option seems to to "fix" it, even with mobile data turned off.

My setup is the same as @ksetrin's:

OS: android react-native: 0.63.4 react-native-tcp-socket: 5.2.0

Rapsssito commented 3 years ago

@traviswsims, it might be related to another process using port 8080 in the WiFi interface.

github-actions[bot] commented 3 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community attention? This issue may be closed if no further activity occurs.