Socket has failed to bind on port
#1

Hi, im using a socket for a small application i made for the server.

Now the problem:
First time when i run the server, all is fine, socket is connected and working.
When i restart the server, on my linux for testing im using: kill process id, then restarting it.
But then suddenly when i restart the server again i get this error in the log:

PHP Code:
socket_listen(): Socket has failed to bind on port XXXX 
Reply
#2

Looks like process is not killed and still running, hence still using given port and when you try to start new process, that port is already taken by previous instance.
Reply
#3

Quote:
Originally Posted by DRIFT_HUNTER
View Post
Looks like process is not killed and still running, hence still using given port and when you try to start new process, that port is already taken by previous instance.
My server doesn't work when i kill him with Linux command, and my socket is unloaded.
I read on goo gle that I have to open the port on my machine..
"Open a TCP port on your firewall (9014 is the default one)."
My server use 7777 port..


PHP Code:
public OnGameModeExit()
{
    if(
is_socket_valid(SocketID))
    {
        
socket_stop_listen(SocketID);
        
socket_destroy(SocketID);
    }
    return 
1;

Reply
#4

BUMP
Reply
#5

BUMP
Reply
#6

Refresh, the problem is not solved..
socket_listen(): Socket has failed to bind on port 9295
I tried different port, but again same problem.
Is there anybody who have experience with the socket??
Reply
#7

Use:
Code:
lsof -i:port
To see what process(es) use a certain port (replace port with the actual port, ofc). Maybe it somehow is still used.
Reply
#8

Quote:
Originally Posted by Kwarde
View Post
Use:
Code:
lsof -i:port
To see what process(es) use a certain port (replace port with the actual port, ofc). Maybe it somehow is still used.
See Attachment


When i restart the server, sometimes this work..
But then suddenly when i restart the server again i get this error in the log
Reply
#9

Yes, it shows that port 7780 is used by samp03svr. After closing the server (killing the process) you should use that command to see if it's somehow still used.
Reply
#10

Quote:
Originally Posted by Kwarde
View Post
Yes, it shows that port 7780 is used by samp03svr. After closing the server (killing the process) you should use that command to see if it's somehow still used.
Now when i restart the server using panel, this message pop out in server.log
And also i tried again lsof -i:7780 and nothing happens
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)