Results 1 to 4 of 4

Thread: help with simple udp

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2004
    Posts
    14

    help with simple udp

    I am getting an error and its really bothering me. I am writing a simple program to receivce data on a port, write it to a file and send it out another port. I have no problem getting it in the first port (winsock1) and writing it to a file. But as soon as i try to send it out winsock2 i get the following error "Runtime error '10047' address family not supported. It shows me the error is at this line: Call Winsock2.SendData("hi")
    what up with that error??? if you look at my code you will see that i am pretty much using the exact code for winsock1 as i am 2.
    Both winsocks are set to udp, i even copy and past winsock1 as winsock2. Its intresting to note that with this line Call Winsock2.SendData(message) i get an error but with this line Call Winsock2.SendData("") i don't. what the heck is up with this?
    attached is my code

    Code:
    Option Explicit
    
    Dim message As String
       
       Dim fso As New FileSystemObject
       Dim fsoStream As TextStream
      
    
    Private Sub Form_Load()
       ' set up local port and wait for connection
       Call Winsock1.Bind(1234)
       Call Winsock2.Bind(4242)
        Set fsoStream = fso.CreateTextFile("c:\junk.txt", True)
    End Sub
    
    Private Sub Form_Terminate()
       Call Winsock1.Close
       Call Winsock2.Close
       fsoStream.Close
       Set fsoStream = Nothing
      Set fso = Nothing
       
    End Sub
    Private Sub winsock1_DataArrival(ByVal bytesTotal As Long)
       
       
       Call Winsock1.GetData(message)  ' get data from client
       fsoStream.WriteLine message
       TxtDebug.Text = TxtDebug.Text & message
       Call Winsock2.SendData(message)
       
    End Sub

  2. #2
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787
    hmmm try removing the call statement......

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2004
    Posts
    14
    Yes i have tried without the call...

  4. #4
    PowerPoster Deepak Sakpal's Avatar
    Join Date
    Mar 2002
    Location
    Mumbai, India
    Posts
    2,424
    Call Winsock2.Bind(4242)
    Call Winsock2.SendData(message)
    Here Winsock2 is accepting incoming connections. Clients connected to Winsock2 can send messages to Winsock2, You can't send messages from Winsock2 to Winsock2 itself.

    Anyone pls correct me if i am wrong.

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