473,372 Members | 925 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,372 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 1390
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.