473,776 Members | 1,665 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

stream associate with socket; will one end block another

Hi,

As I remember theare are In and Out stream associate with a socket.
TcpClient seems there in only one NetworkStream to do both read and write.

Then will it be a conflicit if both side try to send data?

And when one end is sending data, if another end is not calling Recevive or
BeginReceive, will the sender be blocked? Or recevier side network hardware
will read anyway, just our high-end application has not take the data yet?

BTW, if one side use sychronous/asychronous way to receive and send, the
anthoer side does not have to be same, right?

Thanks a lot!
Ryan
Dec 23 '06 #1
1 1316
| As I remember theare are In and Out stream associate with a socket.
| TcpClient seems there in only one NetworkStream to do both read and write.

TCP is a implicit stream. .Net can suface that stream with the
NetworkStream Stream class, however you don't have to use it and can use raw
read/write methods on the socket.

| Then will it be a conflicit if both side try to send data?

Not really. But it could be a problem if your application protocol does not
expect that.

| And when one end is sending data, if another end is not calling Recevive
or
| BeginReceive, will the sender be blocked?

No. Both sides can send or receive at same time. If one side does not take
data fast enouph, the sender could eventually block because of no more
buffer space on receive end.

| Or recevier side network hardware
| will read anyway, just our high-end application has not take the data yet?

Until buffer space is full.

|
| BTW, if one side use sychronous/asychronous way to receive and send, the
| anthoer side does not have to be same, right?

Each side can do either or both. That is a local design choice.

--wjs
Dec 23 '06 #2

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

Similar topics

1
1395
by: Daniel T. | last post by:
I have a connected Socket object and I call: socket.getInputStream().read(); Now as I understand it, the above will block until some data is received or the socket is closed. In the later case, the method will return -1. Is this correct? However, in testing the method doesn't block and immediately returns 255. Even after the connection is closed, the method keeps returning
1
2867
by: John | last post by:
I have a Socket open to a target system. I get the network stream from the open socket and then create a stream reader and stream writer on this stream. The stream reader and writers are operating on different threads. Does anyone know if it is possible to read and write to the same stream using two different streaming object as mentioned here. John
4
18135
by: Chris Tanger | last post by:
Context: C# System.Net.Sockets Socket created with constructor prarmeters Internetwork, Stream and TCP everything else is left at the default parameters and options except linger may be changed as I find appropriate. I am using the socket asynchronously by calling the BeingSend and BeginReceive calls. I would like to be able to call shutdown and close asynchronously if possible.
3
6464
by: Helge Jensen | last post by:
I am implementing a protocol which transmits messages. The messages are most naturally transferred using the a Stream so the protocol can communicate over serial-ports, network links, .... If the other party never answers I must timeout -- not block, and this gives me a problem, since the Stream concept in .NET does not reflect timeouts. If a timeout occurs I will still need to use the same Stream for more messages, for example re-sends....
7
3156
by: simonrigby_uk | last post by:
Hi all, Sorry if this is the incorrect group but I couldn't see anything directly relevant. Can someone confirm for me what happens when two network streams are sent to an application at the same time. My scenario is a small server application that listens on a particular TCP port. I am sending streams of data to it via a client app. Inside
5
12988
by: ad | last post by:
I used use SharpZipLib to compress files in disk. But now I want to compress stream into another stream in memory(the stream not associated with disk file) My pseudo is: Stream InputStream; Stream OutPutStream; DataSet1.WriteXml(InputStream);
5
8057
by: Lee Gillie | last post by:
I am using Cryptography. You can encrypt or decrypt by providing an output stream as a parameter to the CryptoStream constructor. But I need byte arrays, as I am encrypting on the fly to a socket, and need to manage all socket traffic. My thought was a stateful call to my own Encrypt and Decrypt routines. That I would pass a MemoryStream to the CryptoStream constructor. But it appears that for each write CryptoStream does to my memory...
7
9707
by: Ole | last post by:
Hi, I'm going to develop a socket communication between an instrument (running CE 5.0 with Compact Fraework V2) and a PC. As the instrument should only connect to one PC at a time I believe that the sync version of the socket should be the easiest - or what??? (please tell if I'm wrong). Are there anyone who is able to point to a Server and Client example code in C# VS2005 (I've only been able to find a C++ version) ???
8
18009
by: GiBo | last post by:
Hi! Classic situation - I have to process an input stream of unknown length until a I reach its end (EOF, End Of File). How do I check for EOF? The input stream can be anything from opened file through sys.stdin to a network socket. And it's binary and potentially huge (gigabytes), thus "for line in stream.readlines()" isn't really a way to go. For now I have roughly:
0
9628
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10122
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...
1
10061
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9923
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
6722
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5368
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
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2860
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.