Simulacra
New member
- Joined
- Jul 14, 2006
- Messages
- 3
- Programming Experience
- Beginner
Hello all. Let me preface this post with the obviouse statement that i am new to VB.Net. It has been an interesting learning expereince thus far for me trying to learn the language syntax and VB's nueances. I was tasked with writing a small application that communicates via TCP on port 60000. Here is what I am trying to accomplish.
The server listens on port 60000 for incomming conections. When one comes in it then writes the data to a text file and waits for another connection to come in. After it receives the data it then sends an xml file back to the sending interface ackknwledging that the data was sent successfully.
What I have done so far is piece together a few subs from variouse examples that have been provided online and in books to come up with this rough outline.
So this is where I am stuck at. I need to start thdListener() then when that finishes I need to use sendACKN() to send the file and I am not sure how to do this in the Main() sub?
Any suggestions?
Thanks,
Norm
The server listens on port 60000 for incomming conections. When one comes in it then writes the data to a text file and waits for another connection to come in. After it receives the data it then sends an xml file back to the sending interface ackknwledging that the data was sent successfully.
What I have done so far is piece together a few subs from variouse examples that have been provided online and in books to come up with this rough outline.
VB.NET:
Imports System.Net
Imports System.Net.Sockets
Imports System.IO
Imports System.Text
Imports System.Threading
Imports System.Xml
Module Module1
Sub Main()
Dim thdListener As New Thread(New ThreadStart(AddressOf listenerThread))
Dim alSockets = New ArrayList()
Dim thdSend As New Thread(New ThreadStart(AddressOf SendACKN))
' This gets the ball rolling by starting up listenerThread
' which in turn calls handlerThread to do the dirty work
' of writng to a text file.
thdListener.Start()
End Sub
Private alSockets As ArrayList
Public Sub listenerThread() .......
Public Sub handlerThread() .....
Public Sub sendACKN().....
End
Any suggestions?
Thanks,
Norm