473,405 Members | 2,294 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,405 software developers and data experts.

TcpListener & Client - sends to many bytes

Hi
I have a problem:
when i send data:
byte[] fName =
ASCIIEncoding.ASCII.GetBytes(stringFileName);
TcpClient Client = new TcpClient();
Client.Client.Send(fName,fName.Length,SocketFlags. None);
in my case fName is 7

When i receive data on Server
byte[] buffer = new byte[256];
int size = connection.Receive(buffer);

Since size is number of received bytes, in my case it's 256
Any ideas?
PK

fName is filename. I need to send it, to allow server store file, but
until my received name is sentname+TRASH i can't create new file.

Nov 29 '05 #1
1 1394
Hi,

TcpClient.Client is a protected property , you cannot use it.
You use TcpClient.GetStream to get the networkstream .
You should send the size of the string before the string itself, in this way
you can know apriori the amount of data you will gonna get.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


"Piotrekk" <Pi*************@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Hi
I have a problem:
when i send data:
byte[] fName =
ASCIIEncoding.ASCII.GetBytes(stringFileName);
TcpClient Client = new TcpClient();
Client.Client.Send(fName,fName.Length,SocketFlags. None);
in my case fName is 7

When i receive data on Server
byte[] buffer = new byte[256];
int size = connection.Receive(buffer);

Since size is number of received bytes, in my case it's 256
Any ideas?
PK

fName is filename. I need to send it, to allow server store file, but
until my received name is sentname+TRASH i can't create new file.

Nov 29 '05 #2

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

Similar topics

15
by: Michael Rybak | last post by:
hi, everyone. I'm writing a 2-players game that should support network mode. I'm now testing it on 1 PC since I don't have 2. I directly use sockets, and both client and server do...
10
by: Shaniqua Jones | last post by:
I've designed a C# application consisting of two EXEs: a client and server. The server runs on my Win2000 Server box, and the client runs on my customers' machines -- typically XP. The client app...
2
by: MuZZy | last post by:
Hi, The app i develop supose to have a remote control/reporting feature, so that if a client connects to it, he can obtain information about application state and to send some commands. I...
2
by: Chris Johnson | last post by:
Hey guys, A while back I posted a message about multithreading in .NET 2.0 to maintain GUI responsivness while using a TCPListener to monitor a TCP port for transmission. One of the MVP's in the...
5
by: Yossarian | last post by:
I have a handheld running CE .NET 4.2 and I am using c# with framework 1.1 to develop a solution for syncing data that is on the handheld with the local pc. Our handheld cradles only support...
3
by: Jon Slaughter | last post by:
I can't seem to get these to work over my router. I have all the ports open and ftp works from outside. Is there anything special I have to do or what? (my app does work over the LAN though) I'm...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
7
by: ethangk | last post by:
Hey, Im making an app in c#.net, i set up the listener, when it hits the while, it crashes. The code is straight from the ms example, modified a bit for a form instead of command line. Heres the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
0
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...
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
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
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,...

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.