Results 1 to 8 of 8

Thread: more winsock stuff

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    Oshawa, Ontario, Canada
    Posts
    88

    Exclamation

    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
    -|Kn|gHt|
    MSN - [email protected]

  2. #2
    Guest
    It means the port your trying to listen on is already being used.

  3. #3
    Addicted Member ShIzO's Avatar
    Join Date
    Apr 1999
    Location
    Bartlett, IL
    Posts
    189
    hey,


    either you're trying to connect while already connected or your port is in use. try using close() method on that port.
    www.HardFind.com -buy/sell/trade your used hardware.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    Oshawa, Ontario, Canada
    Posts
    88
    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
    -|Kn|gHt|
    MSN - [email protected]

  5. #5
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    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.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    Oshawa, Ontario, Canada
    Posts
    88
    could you possibly give me a code example of how to do this????
    -|Kn|gHt|
    MSN - [email protected]

  7. #7
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    Ummmmm, how to do what?

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    Oshawa, Ontario, Canada
    Posts
    88
    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????
    -|Kn|gHt|
    MSN - [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width