473,387 Members | 1,785 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,387 software developers and data experts.

SocketFlags.None does not work

Hi ,
maybe it is not the right place to ask .

Hi , i have problem about sending data over socket . It waits for another
socket.send

// str = Encoding.ASCII.GetBytes("hello");

socket.Send(str,0,str.Length,SocketFlags.None);

socket.Receive(strincome,0,socket.Available,Socket Flags.None); // return
"hello to you "

// str =Encoding.ASCII.GetBytes( "how_are_you ");

socket.Send(str,0,str.Length,SocketFlags.None);

socket.Receive(strincome,0,socket.Available,Socket Flags.None);// return
"fine"

it sends like this "hellohow_are_you" , but it is wrong , how can i solve it
?
Nov 17 '05 #1
1 2206
"Hasan O" <ho********@gmail.com> wrote in message
news:ub**************@TK2MSFTNGP11.phx.gbl...
// str = Encoding.ASCII.GetBytes("hello");

socket.Send(str,0,str.Length,SocketFlags.None);

socket.Receive(strincome,0,socket.Available,Socket Flags.None); // return
"hello to you "

// str =Encoding.ASCII.GetBytes( "how_are_you ");

socket.Send(str,0,str.Length,SocketFlags.None);

socket.Receive(strincome,0,socket.Available,Socket Flags.None);// return
"fine"

it sends like this "hellohow_are_you" , but it is wrong , how can i solve
it


You are not sending the null byte that terminates the string "hello". If all
your transmissions are strings you will need to add 1 to the length of
everything that you send. Of course, then the receiver has to make the same
assumption either create and array of strings or separate one from the next
by some delimiter.

Regards,
Will
Nov 17 '05 #2

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

Similar topics

13
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
0
by: Sathesh Arumugam | last post by:
Client is sending data a,b,c using seperate send method to the server eg., Socket.Send('a') Socket.Send('b') Socket.Send('c') In the Server we are using Receive method to receive the incoming...
11
by: Hasan O | last post by:
Hi , i have problem about sending data over socket . It waits for another socket.send // str = Encoding.ASCII.GetBytes("hello"); socket.Send(str,0,str.Length,SocketFlags.None); ...
5
by: z. f. | last post by:
sorry about the previous post, by mistake not completed. i have an asp.net page with the line <%@ OutputCache Duration="30" VaryByParam="none" %> but when i make requests to the page with...
0
by: | last post by:
I am trying to communicate through the socket class, but unfortunatly I am haveing a little trouble. The method I am trying to use: Overloads Public Function Receive(Byte(), Integer,Integer,_...
30
by: Raymond Hettinger | last post by:
Proposal -------- I am gathering data to evaluate a request for an alternate version of itertools.izip() with a None fill-in feature like that for the built-in map() function: >>> map(None,...
3
by: Arronax | last post by:
Just a basic question after I didn't see any examples on the web other than the "None" enum. Is this just a way of sending "hints" to server/client, or is there another more valuable use to...
1
by: Ryan Liu | last post by:
Hi, One day I really need have a good study or network, not just C#. But I am in a hurry, can someone explain SocketFlags, is that save I use SocketFlags.None when I call Socket.Receive()...
7
by: libsfan01 | last post by:
Hi all This js i wrote to switch display on and off of a given element does not work in ie but it does in ff and safari. how can i make it work with ie guys? <script...
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...
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: 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
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...

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.