|
-
Nov 2nd, 2000, 04:45 PM
#1
Thread Starter
Lively Member
the error 10048 keeps popping up...Adress In Use
ok....this is not working. i tried using sock.close on that error but it just doesn't work properly!!
what i'm doing is having my client connect to my server....when i click the disconnect but it does a winsock.close
then when i click the connect button again it gives me the error....i'll show you the code for my client and server
client
Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button)
If Button.Index = 1 Then
frmOptions.Show 1
End If
If Button.Index = 3 Then
sock.Close
sock.Connect "127.0.0.1", 7771
Button.Enabled = False
Toolbar1.Buttons.Item(4).Enabled = True
End If
If Button.Index = 4 Then
sock.Close
Button.Enabled = False
Toolbar1.Buttons.Item(3).Enabled = True
End If
If Button.Index = 58 Then
Dim Answer
Answer = MsgBox("Are you sure you want to quit? ", vbExclamation + vbYesNo, "Exit?")
If Answer = vbYes Then
End
End If
End If
End Sub
Server
Option Explicit
Dim Buffer As String
Private Sub Form_Load()
Sock.Listen
End Sub
Private Sub Sock_Close()
If Sock.State <> sckClosed Then
Sock.Close
End If
End Sub
Private Sub Sock_ConnectionRequest(ByVal requestID As Long)
sock2(sock2.UBound).Accept requestID
Load sock2(sock2.UBound + 1)
sock2(sock2.UBound).LocalPort = sock2(sock2.UBound - 1).LocalPort + 1
End Sub
Private Sub sock2_Close(Index As Integer)
sock2(Index).Close
End Sub
Private Sub sock2_DataArrival(Index As Integer, ByVal bytesTotal As Long)
sock2(Index).GetData Buffer, vbString
Text1.Text = Text1.Text + Trim(Buffer) + vbNewLine
If Left(Buffer, 6) = "/Name:" Then
lstNames.AddItem Right(Buffer, Len(Buffer) - 6)
End If
End Sub
all of this code works....i can connect multiple clients to the server but if i click disconnect on one client and try to click connect again after i've already been connected once using the same client it gives me the error!!
please help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|