|
-
Oct 26th, 2004, 11:37 AM
#1
Thread Starter
New Member
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
-
Oct 26th, 2004, 05:59 PM
#2
hmmm try removing the call statement......
-
Oct 27th, 2004, 06:53 AM
#3
Thread Starter
New Member
Yes i have tried without the call...
-
Oct 27th, 2004, 07:09 AM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|