Tewl
xTeam
C# & VB Developer
Posts: 495
|
Post by Tewl on May 22, 2003 4:39:47 GMT -5
How do i find a free port with vb?
|
|
|
Post by AbsoluteGenius on May 22, 2003 7:39:01 GMT -5
in IRCDominator V1 i used a function call to do this
Public Function BindPort(iPort As Integer) As Integer Dim iOldPort As Long
' On Error Resume Next RepeatBind[img]http://proboards8.com/boardimages/sad.gif[/img]br] Err.Clear iOldPort = iPort MDIMain.Svr1.Close MDIMain.Svr1.Bind iPort, "127.0.0.1" MDIMain.Svr1.LocalPort = iPort If Err.Number = "10048" Then Err.Clear iPort = iPort + 1 GoTo RepeatBind End If BindPort = iPort If iOldPort <> iPort Then trace "Port " & iOldPort & " was already in use trying - now using port (" & iPort & ")" End If End Function
|
|