|
I think that's the expected behavior, according to the MSDN documentation. " If the remote host shuts down the Socket connection with the Shutdown method, and all available data has been received, the EndReceive method will complete immediately and return zero bytes". You can therefore assume that if you get 0 bytes received in EndReceive, the remote client has disconnected.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks Senthil,
I didn't see that in the documentation. Much appreciated.
Jub
"If you're too careful, your whole life can become a f---in' grind." - Mike McD (Rounders)
|
|
|
|
|
Does anybody know how to search a word and read values from a file?
I used the method split to read values and separate words but the program doesn't give me the values of the float number. Even this method doesn't give me the correct number of words. It seems to me that it is taken spaces as a words. Any help will be appreciated.
Thank you in advance.
Ps. this is the code...
while(OpenSR.Peek()>=0)
{
string text =OpenSR.ReadLine();//Read line in the file
string [] Data=text.Split(new char[]{' ','\r','\n',',',':','='},10);
foreach(string s in Data)
{
Console.WriteLine("-{0}-", s);
}
Console.WriteLine(Data.Length);
}
|
|
|
|
|
Regular Expressions are what's needed here.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Where do you usually get images/icons from besiding drawing your own..?
Thank you
Elapid For The Win
|
|
|
|
|
Pay a graphic company to make them. There are probably some good link in the recent "logo" post in the lounge.
/\ |_ E X E GG
|
|
|
|
|
google image search
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Try the resources of windows xp in the windows\cursors folder,
and also if you have the visual studio installed try it's resources ,it's very usefull in the Microsoft Visual Studio .NET 2003\common7\ide\graphics
|
|
|
|
|
Search your machine for the extensions applicable to icon or image files (such as ".ico", ".bmp", ".png", ".wmp", ".jpg", etc.). However, be aware of any copyrighted material.
|
|
|
|
|
Hey folks,
Any recommendations for a Csharp editor (with code completion)?
Has to be lightweight - Sharpdevelop is a bit heavy for my laptop.
Thanks,
Davy
My Personal Blog - Homepage
|
|
|
|
|
Borlan used to have one... take a look at www.borland.com
Free your mind...
|
|
|
|
|
|
Thanks - IDE looks pretty cool. Its a bit like DrPython
Davy
My Personal Blog - Homepage
|
|
|
|
|
this is what i need to do:
user enters a date in the DateTimePicker.
the code needs to validate the date agains a few criterias.
if it does not pass the validation. display a message asking if the user really wants that date.
if the user wants to continue with the date, just go ahead.
if not the date should go back to what it was.
I am having the hardest time to get the program to flow thist way.
I tried to extend the datetimepicker to add a onchanging event, i tried the validating event. But so far there is always one thing in this flow that does not work.
Can any one help!
thank you
tephra
|
|
|
|
|
Use the TextChanged event
Darryl Borden
Principal IT Analyst
dborden@eprod.com
|
|
|
|
|
simply use the validating event
with this event you can cancel the leave event via eventarg
|
|
|
|
|
The problem with the validating event is the messagebox. the messagebox kicks the "valuechanged" event. even if i disable the event before the messagebox, the value already changed and the event is not kicked afterwards when i want to. also there is the path that does not go through the messagebox(when the date is valid). and so on...
I keep getting caught on something.
it would be simpler if i could get the messagebox to stop changing the value of the datetimepicker before the validating is finished.
thank you
|
|
|
|
|
...another problem is that the validationEvent is not trigged when I choose a date in the calendar.
|
|
|
|
|
Hello there!
I am currently writing a chat-program. All of the network functions are (almost) working properly. But i have one problem though. I want the richTextBox to autoscroll when the text goes behind the border of the control (like Windows Messenger)
I hope that you can help me with this!
Regards
|
|
|
|
|
richTextBox1.Focus();
richTextBox1.SelectionStart=richTextBox1.TextLength;
richTextBox1.ScrollToCaret();
Darryl Borden
Principal IT Analyst
dborden@eprod.com
|
|
|
|
|
Thanks a lot!!
I tried something similar, but it didn't work..
Thanks Again!
Regards
|
|
|
|
|
I'm using odbc to call stored procedures in a way similar to the small amount of sample code below:
OdbcCommand command = conn.CreateCommand();
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "call proc(?, ?, ?, ?, ?, ?, ?, ?, ?)";
OdbcParameter param = new OdbcParameter("paraName", OdbcType.VarChar, 4);
param.Direction = ParameterDirection.Input;
command.Parameters.Add(param);
command.ExecuteNonQuery();
...and then accessing them like this:
command.Parameters["paraName"].Value;
This has been working great; except now I have encountered a situation where the stored procedure is attempting to return an entire table (instead of a single record) as one of its output parameters. How do I handle this? Is there a special Odbctype that I should be using? And then, how I access each record within the table once it has been retrieved?
Thanks!
|
|
|
|
|
Hello,
Here's what I'd like to do:
I have a byte[]. This could contain anything. I want to search it and replace every instance of "OldText" with "NewText". I'm actually trying to expand a token. So if I find the token, I want to replace it with the expanded value. Here's what I'm trying to do (pseudo-code)
------------------------------------------------------------------------
string Token = "%SomeToken%";
string Value = "ExpandedToken";
byte[] Data = GetRegBinary(); // Data contains some REG_BINARY data
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
// Convert the OldText to Base64String
byte[] buf1 = enc.GetBytes(Token);
string OldText = Convert.ToBase64String(buf1);
// Convert the NewText to Base64String
byte[] buf2 = enc.GetBytes(Value);
string NewText = Convert.ToBase64String(buf2);
// Convert the target data to Base64String
string TargetData = Convert.ToBase64String(Data);
// Now replace the OldData with the NewData in the TargetData
TargetData = TargetData.Replace(OldData, NewData);
// Convert the TargetData back to Byte[]
Data = Convert.FromBase64String(TargetData);
------------------------------------------------------------------------
I was hoping I could use some built-in encoding so I wouldn't have to write my own. This seems like a good logical approach but it's not working (I don't know why) and I'm getting the feeling that I'm using the wrong tool for the job...
Any ideas?
Thanks!
-Ian
|
|
|
|
|
What about something like the following:
ASCIIEncoding ae = new ASCIIEncoding();
byte[] bInput = ae.GetBytes("Hello Nick");
string sConversion = ae.GetString(bInput);
string sOutput = sConversion.Replace("Nick", "World");
byte[] bOutput = ae.GetBytes(sOutput);
|
|
|
|
|
Beautiful! Thank you!
-Ian
|
|
|
|