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




Reply With Quote