SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 23/05/2020, 01:02 PM   #1
OsmanMalagic
Little Clucker
 
Join Date: Jul 2016
Location: EX-YU
Posts: 41
Reputation: 51
Default Socket has failed to bind on port

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 
OsmanMalagic is offline   Reply With Quote
Old 23/05/2020, 01:47 PM   #2
DRIFT_HUNTER
High-roller
 
Join Date: Oct 2009
Posts: 2,152
Reputation: 215
Default Re: Socket has failed to bind on port

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.
DRIFT_HUNTER is offline   Reply With Quote
Old 23/05/2020, 02:33 PM   #3
OsmanMalagic
Little Clucker
 
Join Date: Jul 2016
Location: EX-YU
Posts: 41
Reputation: 51
Default Re: Socket has failed to bind on port

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;

OsmanMalagic is offline   Reply With Quote
Old 25/05/2020, 05:13 PM   #4
OsmanMalagic
Little Clucker
 
Join Date: Jul 2016
Location: EX-YU
Posts: 41
Reputation: 51
Default Re: Socket has failed to bind on port

BUMP
OsmanMalagic is offline   Reply With Quote
Old 27/05/2020, 11:08 AM   #5
OsmanMalagic
Little Clucker
 
Join Date: Jul 2016
Location: EX-YU
Posts: 41
Reputation: 51
Default Re: Socket has failed to bind on port

BUMP
OsmanMalagic is offline   Reply With Quote
Old 28/06/2020, 03:47 PM   #6
OsmanMalagic
Little Clucker
 
Join Date: Jul 2016
Location: EX-YU
Posts: 41
Reputation: 51
Default Re: Socket has failed to bind on port

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??
OsmanMalagic is offline   Reply With Quote
Old 28/06/2020, 04:02 PM   #7
Kwarde
High-roller
 
Kwarde's Avatar
 
Join Date: Nov 2009
Location: The Netherlands
Posts: 2,735
Reputation: 1686
Default Re: Socket has failed to bind on port

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.
__________________
When the opportunity presents itself to flip-a da table, uh, you flip-a da table.

Discord: Kwarde#8009
Kwarde is offline   Reply With Quote
Old 28/06/2020, 05:06 PM   #8
OsmanMalagic
Little Clucker
 
Join Date: Jul 2016
Location: EX-YU
Posts: 41
Reputation: 51
Default Re: Socket has failed to bind on port

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
Attached Images
File Type: png sockett.png (20.5 KB, 6 views)
OsmanMalagic is offline   Reply With Quote
Old 28/06/2020, 05:11 PM   #9
Kwarde
High-roller
 
Kwarde's Avatar
 
Join Date: Nov 2009
Location: The Netherlands
Posts: 2,735
Reputation: 1686
Default Re: Socket has failed to bind on port

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.
__________________
When the opportunity presents itself to flip-a da table, uh, you flip-a da table.

Discord: Kwarde#8009
Kwarde is offline   Reply With Quote
Old 28/06/2020, 05:16 PM   #10
OsmanMalagic
Little Clucker
 
Join Date: Jul 2016
Location: EX-YU
Posts: 41
Reputation: 51
Default Re: Socket has failed to bind on port

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
Attached Images
File Type: png socket_1.png (3.1 KB, 4 views)
OsmanMalagic is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Port Forward Failed (Filtered Port) PiLLoW Server Support 2 30/04/2017 01:16 PM
Plugin socket failed to load at starting server sojoxd Scripting Help 5 25/02/2015 07:41 PM
were can i find socket v0.1b ? all socket links are dead? Samieastwood Scripting Help 2 16/11/2014 01:41 PM
Socket has failed to bind on port dreamboxxl Server Support 1 10/08/2014 06:25 AM
port forwarding? I failed to.. jimmyNL Server Support 3 10/12/2012 02:23 PM


All times are GMT. The time now is 01:49 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.