mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
/socklisten: port error (line 67,script1.mrc)

hello, I have forgotten what you do to remedy this issue. Can someone help remind me please?

I really appreciate it, thanks.

Line 67 is /socklisten Open.

Code:
_conn {
  if ($sock(_conn)) sockclose _conn
  if ($sock(Open)) sockclose open
  socklisten Open
  .server 127.0.0.1 $Sock(Open).port
  if (!$timer(_dc)) .timer_dc 0 69 /_dc
}


Joined: Jul 2006
Posts: 4,213
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,213
I think you must provide a port after the name.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
From the help file:
Quote:
/socklisten [-d] [bindip] <name> [port]

[...] If a port isn't specified, the port is selected randomly from the range specified in the DCC Options dcc ports section.

So either this is a wrong (random) port or - looking at the IP address on the next line - your modem/router doesn't like looping.

Just my guess.

Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Well I have been running this script for 2 years. I have heard of this issue popping up but it's so random. I wondered if anyone may know the reason.

I did designate a port. I said:

Code:
if (!$portfree($port)) var %vn_p = $calc($port + 1)
socklisten Open %vn_p


but that didnt help.

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Try this..

Code:
_conn {
  sockclose _conn
  sockclose open
  var %port = 1
  ; If you don't want the port range to start at 1, then change 1 to a higher number.
  while (!$portfree(%port)) && (%port < 65536) inc %port
  socklisten Open %port
  .server 127.0.0.1 %port
  if (!$timer(_dc)) .timer_dc 0 69 /_dc
}


This should always find a free port, unless every single one of your ports is in use, which is highly unlikely if it's even possible.

I also changed the first two lines because mIRC's /sockclose command has built-in error checking, so you don't need to check if ($sock(_conn)) before attempting to /sockclose it.

Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Thanks hixxy I'll give this a try.

This occured when I added my connection code to someone else's script. What are the chances that their script is causing this error?

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Possible but not likely, as the error points to your /socklisten command.

Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
It's weird. I took a mirc and its mirc.ini that I had been using. I put it in a new folder with my conneciton files that has worked well for the past 2 years on nearly 2000 users machines.

I get the error. I delete mirc.exe and mirc.ini and replace them with mirc from the install folder and it works fine. What setting could it be?

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Maybe the firewall/proxy settings? Not 100% sure if they affect sockets or not though.


Link Copied to Clipboard