473,412 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Working with TCPclient

Hi!

Trying to get my head around working with network connectivity in VB.Net.
I've gotten a fairly decent control based on the sample in the 101VBSamples
available from Microsoft.What I'm having problems with is the
GetStream.BeginRead method. Problem is that it's all one way... My
application connects and is able to send data, but I don't have much in the
way to provide realtime data back from my control

Is GetStrem.BeginRead method a line based method? i.e. Does it wait for the
CR/LF before it fires the delegate to read the buffer?

Is there a character based equivilent method? How about being able to fire
the delegate whenever there is any data at all in the buffer?

Basically, I want to watch the data stream for specific strings and fire an
event when they happen. I also want to have a realtime input buffer that
doesn't depends on a CR/LF to add data to the buffer.

Any help is appreciated!
Nov 20 '05 #1
2 3192

"Noozer" <po********@127.0.0.1> wrote in message
news:O%****************@TK2MSFTNGP12.phx.gbl...
Hi!

Trying to get my head around working with network connectivity in VB.Net.
I've gotten a fairly decent control based on the sample in the 101VBSamples available from Microsoft.What I'm having problems with is the
GetStream.BeginRead method. Problem is that it's all one way... My
application connects and is able to send data, but I don't have much in the way to provide realtime data back from my control

Is GetStrem.BeginRead method a line based method? i.e. Does it wait for the CR/LF before it fires the delegate to read the buffer?

Is there a character based equivilent method? How about being able to fire
the delegate whenever there is any data at all in the buffer?

Basically, I want to watch the data stream for specific strings and fire an event when they happen. I also want to have a realtime input buffer that
doesn't depends on a CR/LF to add data to the buffer.

Any help is appreciated!


It Sounds like you used the Winsock control a lot with older lanuages.. The
TCPClient Class works a whole lot differently in comparison. Have you
looked in the 101samples there should be a client Server chat program(If
there isn't let me know and I'll post some code for one). The TCPClient
class is all streams so your going to be directly working with Byte Arrays
to get anything from it, no more directly sending strings, no waiting for
CR/LF it just waits until the Buffer is filled or the other end has send all
its relevante data. There is also the Read method which will just read
bytes out of the buffer but it will sit there and hang your app if no data
is sent for awhile for Beginread is almost always your best choice.

If you're just wonder how the TCPClient works or want to see some samples
I'm sure we could find them for you. I've put quite a few things together
that uses that class.

Hope This helps some.

Nov 20 '05 #2
> > Trying to get my head around working with network connectivity in
VB.Net.
I've gotten a fairly decent control based on the sample in the 101VBSamples
available from Microsoft.What I'm having problems with is the
GetStream.BeginRead method. Problem is that it's all one way... My
application connects and is able to send data, but I don't have much in

the
way to provide realtime data back from my control

Is GetStrem.BeginRead method a line based method? i.e. Does it wait for

the
CR/LF before it fires the delegate to read the buffer?

Is there a character based equivilent method? How about being able to fire the delegate whenever there is any data at all in the buffer?

Basically, I want to watch the data stream for specific strings and fire

an
event when they happen. I also want to have a realtime input buffer that
doesn't depends on a CR/LF to add data to the buffer.

Any help is appreciated!

It Sounds like you used the Winsock control a lot with older lanuages.. The TCPClient Class works a whole lot differently in comparison. Have you
looked in the 101samples there should be a client Server chat program(If
there isn't let me know and I'll post some code for one). The TCPClient
class is all streams so your going to be directly working with Byte Arrays
to get anything from it, no more directly sending strings, no waiting for
CR/LF it just waits until the Buffer is filled or the other end has send all its relevante data. There is also the Read method which will just read
bytes out of the buffer but it will sit there and hang your app if no data
is sent for awhile for Beginread is almost always your best choice.
Thanks! Quite helpful... If I understand, I can set the buffer size to 1 and
then I can be guarranteed that there is no leftover data in the half empty
buffer? You say that it waits "until the buffer is filled or the other end
has sent all it's relevant data" - How does it know that the other end is
done sending it's data?
If you're just wonder how the TCPClient works or want to see some samples
I'm sure we could find them for you. I've put quite a few things together
that uses that class.


Appreciated, but not necessary... I'll figure it out.

Thanks again!
Nov 20 '05 #3

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

Similar topics

3
by: Daniel | last post by:
TcpClient close() method socket leak when i use TcpClient to open a connection, send data and close the TcpClient with myTcpClientInstance.Close(); it takes 60 seconds for the actual socket on...
2
by: Theo | last post by:
Hi, I am using a tcpclient and a tcplistener to send and receive packets. The client sends a packet and the listener replies with another one. I can send 2 packets and get an answer from the...
3
by: מורדי | last post by:
Hi, I'm writing a client/server application in which the client send a series of screenshots to the server to be saved using the tcpclient. in most cases the first screenshot is transmitted ok...
3
by: Ricardo Quintanilla | last post by:
i had a problem whom i do not know how to explain. i was using a TcpClient (System.Net.Sockets.TcpClient) object to send and receive data to an AS400 socket. Two months ago it started to work...
3
by: Danny Tuppeny | last post by:
Hi all, I'm trying to send a null character as a string delimiter through a TcpClient (code below). It's to connect to this poker bot room: http://games.cs.ualberta.ca/webgames/poker/bots.html...
0
by: Torsten Brasch | last post by:
Hi All and Happy New Year ;) I have a very strange problem with System.Net.Sockets.TcpClient(). For some reason, the number of bytes I can receive is limited to 5460 bytes. I made sure that the...
1
by: hamil | last post by:
I am having trouble using the TcpListener and TcpClient classes. At the end of this post is server code that runs, and a class whose purpose is described below. I need to know when the client...
2
by: craigkenisston | last post by:
I'm creating a TcpClient instance in an object which is created in a thread. I have a loop that goes about 6-7 cycles, creating the container object in each cycle and each object contains a...
5
by: puzzlecracker | last post by:
It looks like i need to get IPEndPoint first, but I cannot figure out from msdn the eventual obtainment of machine name and port number. Please suggest a solution. Thanks
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.