I'm having a problem with an error with the winsock control...
its error 10048 Address in use
if anyone knows how to deal with this error could you please write back asap.
thanx
Printable View
I'm having a problem with an error with the winsock control...
its error 10048 Address in use
if anyone knows how to deal with this error could you please write back asap.
thanx
It means the port your trying to listen on is already being used.
hey,
either you're trying to connect while already connected or your port is in use. try using close() method on that port.
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
There is a period of time that you will have to wait before you can reconnect. I have modified my client/server demo, adding a Connect/Close command button. The client 'acts' as though it reconnects, but flow does not stop at my break point in the server's ConnectionRequest code.
This tells me that the connect request is not reaching the server.
I cannot say at this time how long a wait is necessary before the server will be ready for the next connect request. I do know that we have the same situation connecting to servers running on our Tandem systems. The time delay between connections is somewhere over a minute.
could you possibly give me a code example of how to do this????
Ummmmm, how to do what?
how to do
There is a period of time that you will have to wait before you can reconnect. I have modified my client/server demo, adding a Connect/Close command button. The client 'acts' as though it reconnects, but flow does not stop at my break point in the server's ConnectionRequest code.
This tells me that the connect request is not reaching the server.
I cannot say at this time how long a wait is necessary before the server will be ready for the next connect request. I do know that we have the same situation connecting to servers running on our Tandem systems. The time delay between connections is somewhere over a minute.
example code please????