473,654 Members | 3,115 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TCP send & Recieve

I have have lifted some code that I am trying to make work in 2 seperate
projects it appears to send okay but the it only recieves once then it stop
recieving I am unsure as to why ?

******** sending ****
Private Sub SendAction(ByVa l DoAction, ByVal RemoteAddress)
Dim Actionport As Integer = 40000
Dim TCPClient As New TcpClient(Remot eAddress, Actionport)
Dim TCPNetworkStrea m As NetworkStream = TCPClient.GetSt ream
Dim TCPStreamWriter As New StreamWriter(TC PNetworkStream)
Try
TCPStreamWriter .Write(DoAction )
Catch ex As Exception
ErrorCondition = ex.Message
End Try
TCPStreamWriter .Close()
TCPNetworkStrea m.Close()
TCPClient.Close ()
End Sub

****** recieving *****

Dim localhostaddres s As IPAddress = MSearchObj.Acti veIP

Dim Lport As Integer = 40000
Dim TcpListener As New TcpListener(loc alhostaddress, Lport)
TcpListener.Sta rt()

Dim TCPClient As TcpClient = TcpListener.Acc eptTcpClient()
Dim TCPNetworkStrea m As NetworkStream = TCPClient.GetSt ream
Dim TCPStreamReader As New StreamReader(TC PNetworkStream)

errorcondition = ""
Do While errorcondition. Length = 0

RecievedData = ""
SendData = ""

If TcpListener.Pen ding = False Then
Thread.Sleep(10 0)
Else
Do While TCPStreamReader .EndOfStream = False
RecievedData = TCPStreamReader .ReadLine
If RecievedData <> "" Then
ProcessInput(Re cievedData, SendData, MSearchObj,
DBobj)
End If
Loop
Thread.Sleep(10 00)
End If
Loop


May 1 '06 #1
4 5577
Try not using the close statements at the end. You are disconnecting
yourself with these statements.

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com

"Tlink" <Tl***@online.n ospam> wrote in message
news:eU******** ******@TK2MSFTN GP03.phx.gbl...
I have have lifted some code that I am trying to make work in 2 seperate
projects it appears to send okay but the it only recieves once then it stop
recieving I am unsure as to why ?

******** sending ****
Private Sub SendAction(ByVa l DoAction, ByVal RemoteAddress)
Dim Actionport As Integer = 40000
Dim TCPClient As New TcpClient(Remot eAddress, Actionport)
Dim TCPNetworkStrea m As NetworkStream = TCPClient.GetSt ream
Dim TCPStreamWriter As New StreamWriter(TC PNetworkStream)
Try
TCPStreamWriter .Write(DoAction )
Catch ex As Exception
ErrorCondition = ex.Message
End Try
TCPStreamWriter .Close()
TCPNetworkStrea m.Close()
TCPClient.Close ()
End Sub

****** recieving *****

Dim localhostaddres s As IPAddress = MSearchObj.Acti veIP

Dim Lport As Integer = 40000
Dim TcpListener As New TcpListener(loc alhostaddress, Lport)
TcpListener.Sta rt()

Dim TCPClient As TcpClient = TcpListener.Acc eptTcpClient()
Dim TCPNetworkStrea m As NetworkStream = TCPClient.GetSt ream
Dim TCPStreamReader As New StreamReader(TC PNetworkStream)

errorcondition = ""
Do While errorcondition. Length = 0

RecievedData = ""
SendData = ""

If TcpListener.Pen ding = False Then
Thread.Sleep(10 0)
Else
Do While TCPStreamReader .EndOfStream = False
RecievedData = TCPStreamReader .ReadLine
If RecievedData <> "" Then
ProcessInput(Re cievedData, SendData, MSearchObj,
DBobj)
End If
Loop
Thread.Sleep(10 00)
End If
Loop

May 1 '06 #2
This did not help in any way it still continues behaves in the same manner.

"vbnetdev" <vb******@commu nity.nospam> wrote in message
news:uj******** ******@TK2MSFTN GP02.phx.gbl...
Try not using the close statements at the end. You are disconnecting
yourself with these statements.

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com

"Tlink" <Tl***@online.n ospam> wrote in message
news:eU******** ******@TK2MSFTN GP03.phx.gbl...
I have have lifted some code that I am trying to make work in 2 seperate
projects it appears to send okay but the it only recieves once then it
stop recieving I am unsure as to why ?

******** sending ****
Private Sub SendAction(ByVa l DoAction, ByVal RemoteAddress)
Dim Actionport As Integer = 40000
Dim TCPClient As New TcpClient(Remot eAddress, Actionport)
Dim TCPNetworkStrea m As NetworkStream = TCPClient.GetSt ream
Dim TCPStreamWriter As New StreamWriter(TC PNetworkStream)
Try
TCPStreamWriter .Write(DoAction )
Catch ex As Exception
ErrorCondition = ex.Message
End Try
TCPStreamWriter .Close()
TCPNetworkStrea m.Close()
TCPClient.Close ()
End Sub

****** recieving *****

Dim localhostaddres s As IPAddress = MSearchObj.Acti veIP

Dim Lport As Integer = 40000
Dim TcpListener As New TcpListener(loc alhostaddress, Lport)
TcpListener.Sta rt()

Dim TCPClient As TcpClient = TcpListener.Acc eptTcpClient()
Dim TCPNetworkStrea m As NetworkStream = TCPClient.GetSt ream
Dim TCPStreamReader As New StreamReader(TC PNetworkStream)

errorcondition = ""
Do While errorcondition. Length = 0

RecievedData = ""
SendData = ""

If TcpListener.Pen ding = False Then
Thread.Sleep(10 0)
Else
Do While TCPStreamReader .EndOfStream = False
RecievedData = TCPStreamReader .ReadLine
If RecievedData <> "" Then
ProcessInput(Re cievedData, SendData, MSearchObj,
DBobj)
End If
Loop
Thread.Sleep(10 00)
End If
Loop


May 1 '06 #3
Hi,

Send zipped project to

ad***@nospamkjm solutions.com

remove no spam and let me see what I can do.

Kelly

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com

"Tlink" <Tl***@online.n ospam> wrote in message
news:uP******** *****@TK2MSFTNG P03.phx.gbl...
This did not help in any way it still continues behaves in the same
manner.

"vbnetdev" <vb******@commu nity.nospam> wrote in message
news:uj******** ******@TK2MSFTN GP02.phx.gbl...
Try not using the close statements at the end. You are disconnecting
yourself with these statements.

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com

"Tlink" <Tl***@online.n ospam> wrote in message
news:eU******** ******@TK2MSFTN GP03.phx.gbl...
I have have lifted some code that I am trying to make work in 2 seperate
projects it appears to send okay but the it only recieves once then it
stop recieving I am unsure as to why ?

******** sending ****
Private Sub SendAction(ByVa l DoAction, ByVal RemoteAddress)
Dim Actionport As Integer = 40000
Dim TCPClient As New TcpClient(Remot eAddress, Actionport)
Dim TCPNetworkStrea m As NetworkStream = TCPClient.GetSt ream
Dim TCPStreamWriter As New StreamWriter(TC PNetworkStream)
Try
TCPStreamWriter .Write(DoAction )
Catch ex As Exception
ErrorCondition = ex.Message
End Try
TCPStreamWriter .Close()
TCPNetworkStrea m.Close()
TCPClient.Close ()
End Sub

****** recieving *****

Dim localhostaddres s As IPAddress = MSearchObj.Acti veIP

Dim Lport As Integer = 40000
Dim TcpListener As New TcpListener(loc alhostaddress, Lport)
TcpListener.Sta rt()

Dim TCPClient As TcpClient = TcpListener.Acc eptTcpClient()
Dim TCPNetworkStrea m As NetworkStream = TCPClient.GetSt ream
Dim TCPStreamReader As New StreamReader(TC PNetworkStream)

errorcondition = ""
Do While errorcondition. Length = 0

RecievedData = ""
SendData = ""

If TcpListener.Pen ding = False Then
Thread.Sleep(10 0)
Else
Do While TCPStreamReader .EndOfStream = False
RecievedData = TCPStreamReader .ReadLine
If RecievedData <> "" Then
ProcessInput(Re cievedData, SendData, MSearchObj,
DBobj)
End If
Loop
Thread.Sleep(10 00)
End If
Loop



May 1 '06 #4
Kelly,

worked it out, the solution is to the place all the processing items
within the do while loop this ensures that the active listener is active and
ready.

"vbnetdev" <vb******@commu nity.nospam> wrote in message
news:ej******** ******@TK2MSFTN GP05.phx.gbl...
Hi,

Send zipped project to

ad***@nospamkjm solutions.com

remove no spam and let me see what I can do.

Kelly

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com

"Tlink" <Tl***@online.n ospam> wrote in message
news:uP******** *****@TK2MSFTNG P03.phx.gbl...
This did not help in any way it still continues behaves in the same
manner.

"vbnetdev" <vb******@commu nity.nospam> wrote in message
news:uj******** ******@TK2MSFTN GP02.phx.gbl...
Try not using the close statements at the end. You are disconnecting
yourself with these statements.

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com

"Tlink" <Tl***@online.n ospam> wrote in message
news:eU******** ******@TK2MSFTN GP03.phx.gbl...
I have have lifted some code that I am trying to make work in 2 seperate
projects it appears to send okay but the it only recieves once then it
stop recieving I am unsure as to why ?

******** sending ****
Private Sub SendAction(ByVa l DoAction, ByVal RemoteAddress)
Dim Actionport As Integer = 40000
Dim TCPClient As New TcpClient(Remot eAddress, Actionport)
Dim TCPNetworkStrea m As NetworkStream = TCPClient.GetSt ream
Dim TCPStreamWriter As New StreamWriter(TC PNetworkStream)
Try
TCPStreamWriter .Write(DoAction )
Catch ex As Exception
ErrorCondition = ex.Message
End Try
TCPStreamWriter .Close()
TCPNetworkStrea m.Close()
TCPClient.Close ()
End Sub

****** recieving *****

Dim localhostaddres s As IPAddress = MSearchObj.Acti veIP

Dim Lport As Integer = 40000
Dim TcpListener As New TcpListener(loc alhostaddress, Lport)
TcpListener.Sta rt()

Dim TCPClient As TcpClient = TcpListener.Acc eptTcpClient()
Dim TCPNetworkStrea m As NetworkStream = TCPClient.GetSt ream
Dim TCPStreamReader As New StreamReader(TC PNetworkStream)

errorcondition = ""
Do While errorcondition. Length = 0

RecievedData = ""
SendData = ""

If TcpListener.Pen ding = False Then
Thread.Sleep(10 0)
Else
Do While TCPStreamReader .EndOfStream = False
RecievedData = TCPStreamReader .ReadLine
If RecievedData <> "" Then
ProcessInput(Re cievedData, SendData, MSearchObj,
DBobj)
End If
Loop
Thread.Sleep(10 00)
End If
Loop




May 2 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1825
by: ifmusic | last post by:
i have this sort of server - client (which is described as servents in the gnutella specification, and it's what i'm trying to do..) And this is what happens: SOMETIMES, when computer A sends through a socket 37bytes, Computer B recieves 37bytes, and prints certain info about it. Now, other more irritating TIMES, computer A has to send two Packet, one first, then another, both 37bytes long , the Send function on computer A Tells me, Hey!...
1
1173
by: Kiran | last post by:
how to send and recieve objects to java web services from .net client
3
1822
by: Nathan Sokalski | last post by:
I have an ASP.NET page that sends a Mail.MailMessage to several email addresses (all mine). However, one of the addresses, the one ending in @verizon.net, does not seem to be recieving the message even though the other addresses are. I know the spelling is correct because I have tried sending messages from my other accounts to this address and have recieved them successfully. I also do not know of any junkmail filter that would delete the...
1
1919
by: Jay | last post by:
Hello, I am developing a chat application in C# where I want to send/recieve emotion icons. Is there a way to implement this feature? Regards Jayshri
1
1650
by: Marx | last post by:
Hello! pls. help me to create a program in vb that can send and recieve sms from a gsm modem(wavecom). PLS. HELP ME thanx inadvance!
4
1487
by: Bhavesh1978 | last post by:
Hey guys.. i know its a biggest challenge in my life that i have to create a program that can send and recieve sms in php and soap n i dont know abt sql any idea how i can start frm scratch? i really greatfull if anyone can help me round. thanks
0
3852
by: hrakbari | last post by:
Hi, i want to use a software called FloAt's Mobile Agent,this software send/recieve Sms at normal rate, i recieve text and i have script that save the SMS in text file, i will read this file and make quiery in data base and save answer in text file, now i need script to load the file into mobile agent software as SMS autofill and also auto fill the Mobile number of the person. Please help me! Regards, Hamid
1
2929
by: secutos | last post by:
When a TcpListener accepts a connection, it returns a TcpClient, which allows you to recieve data. But what about TcpListener.Server.Receive? Does that also allow to receive data in the same way? Or does the TcpClient returned only recieve data from that current connection while TcpListener.Server.Receive receives data from all connections? I do have mutliple connections in my TcpListener.
12
11398
by: neovantage | last post by:
Hi, I am working on an image to process it with different ways/options given in the page. My page name is cart and it has an uploaded image having thumbnail view. When i click on that thumbnail it opens in a highfi technology thickbox. In my cart there are more than 1 images which can be process/manuplate with different options given in the cart. Now what i want is that i need to send some extra values as a parameters so that i can...
0
8290
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8815
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8708
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8594
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7307
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1596
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.