|
I am new to network programming. May be its a basic question, I surely can get help with ur input.
I have a TCP Client class and when I have a message to send I initialize tcpclient, connect and send the message. Now I have a time out till i wait for response. I am waiting for response,
My question is : Can I send another message while waiting for response.
After I receive a response I close the tcpClient.It is a disconnected client.
|
|
|
|
|
I don't know about TcpClient class but the Socket class has asynchronous method calls like BeginSend, BeginAccept, etc.
|
|
|
|
|
TCP is a dual mode protocol and you can send while waiting on a response. You would have to use non-blocking code, however. (Asynchronous calls).
Based on your scenario the ungaraunteed UDP may be an option to consider.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
I think i understand what you r saying, you have to wait until u get the response for the command. If there is any request in between (during wait), you have send it right?
For that you can use TCP asynchronous send/receive method, but u include a packet identifier eg. PACKET#1 as part of the message, on the receiver end the response should be made with this packet identifier. (like a handshake mechanism)
|
|
|
|
|
Hi, I just started using C# to try and make a program that does a small bit of things.
For starters I already have it loading pictures. But it saves them as the original size, I want it to save whats in the picture_box (which is 641x468). Another thing is I want the program to mirror a certain area of the picture_box in the picture_box below the certain area. I also want the program to add a 30% brightness to the mirrored section. I also want to be able to move the image I loaded in the picture_box and have the mirror update with the new mirrored section of the image, And I want it to save like that.
Is there any chance someone could help me out with this bit?
Im also using Visual Studio 2005.
I am bored with it all...
|
|
|
|
|
what is the mainwork of constructtor
hi friends do somthing different........from other..........
|
|
|
|
|
|
To construct a new object, for example a person object:
new Person("moron", true);
|
|
|
|
|
Straight from a google search of "constructor"
In object-oriented programming, a constructor (sometimes shortened to ctor) in a class is a special block of statements called when an object is created, either when it is declared (statically constructed on the stack, possible in C++ but not in Java and other object-oriented languages) or dynamically constructed on the heap through the keyword "new".
A constructor is similar to an instance method, but it differs from a method in that it never has an explicit return type, it's not inherited, and usually has different rules for scope modifiers. Constructors are often distinguished by having the same name as the declaring class. Their responsibility is to initialize the object's data members and to establish the invariant of the class, failing if the invariant isn't valid. A properly written constructor will leave the object in a 'valid' state. Immutable objects must be initialized in a constructor.
Cheers,
|
|
|
|
|
opps ugly message - and I cant edit it :P. just search the definition!!
|
|
|
|
|
Hello All,
Was only hoping for some direction as to a problem I am trying to figure out. I have an array of characters and for this purpose the characters are ABC|C|D|E|F|G|H|I|JKL|...|XYZ|
Here is the issue: I want to find ABC| so that I could read everything after is until I get to JKL|. And then again until I get to XYZ|. Since each char is separately enumerated in the array, is there a way that I could check for the above mentioned string of chars?
I have tried but I keep getting stopped and the one that looked liked it worked... well... was so convoluted, I didn't understand what I did after I wrote it.
Any bone thrown this way would be greatly appreciated.
|
|
|
|
|
If you're doing this in an array of characters and not a string, then I think I would implement a string method to do pretty much the same thing as the string class but on a char array. Then your searching may become somewhat easier. So... IndexOf("ABC") IndexOf("JKL") and grab what you need to based on those indexes.
Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|
|
wat u trying to achieve here? r u trying read the characters in between the two known string (ABC & JKL)
by the way how come the strings ("ABC" AND "JKL") got stored in char array.
if all of them are stored in char array, you can form these lettere by just appending them (upto 3 char) and compare it with Known string (ABC OR JKL)
|
|
|
|
|
Thank you carbon_golem for your response.
Srini,
srini wrote: wat u trying to achieve here? r u trying read the characters in between the two known string (ABC & JKL)
Yes I am. Let's say I want to write what is between ABC and JKL to a file and then write what's in between JKL and XYZ to the same file.
I can almost see what you are getting at. May I be so bold as to ask if you could expand on it a little bit more.
Also:
srini wrote: by the way how come the strings ("ABC" AND "JKL") got stored in char array.
I was just giving a clear example
|
|
|
|
|
You could use this:
string[] parts = mystring.Split('|');
Then, you could iterate through the string array (parts) to get your values. BTW, you probably don't want to end your string with a "|" character.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi,
I am trying to save file (with path) extracted using OpenFileDialog to my app.config settings so the file gets loaded automatically on next execution. Can someone help
|
|
|
|
|
You want to use "settings", not app.config...
In project, right click the project tree item, and select
Add | New Item... | Settings File. <br />
<br />
<div class="ForumSig"> <div style="border:2px solid #FF9900;color:#000000;background-color:#FDF3CF;font-family:Arial;font-size:11px; padding:5px 5px 5px 5px;"><br />
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997<br />-----<br />"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001</div><br />
</div>
|
|
|
|
|
How do I use the settings. I was able to create settings but the data will be different from user to user.
|
|
|
|
|
You can have application-specific settings. You tend to learn things better (and faster) when you work them out on your own instead of asking a question and waiting for an answer.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
C#/Asp.net SQL question
=======================
Trying to Delete from SQL database through c# code
SqlDataSource s = (SqlDataSource)SqlDataSource1;
s.DeleteCommand = "Delete FROM Messages WHERE MessageID=id";
s.Delete();
('id' was defined like this
int id = Convert.ToInt32(TextBox1.Text.ToString());)
If I say MessageID = 5 instead of MessageID = id it works fine
(s.DeleteCommand = "Delete FROM Messages WHERE MessageID=5";)
Why can't I use variable instead of a value? Can you please help?
|
|
|
|
|
you probably meant to put the value of the variable into the delete command, not the name of the variable:
s.DeleteCommand = string.Format("Delete FROM Messages WHERE MessageID={0}", id);
|
|
|
|
|
Thanks a lot Jimmanuel! I really appreciate it!
First time using this message board and I got the right answer!
|
|
|
|
|
i want to start a program from my application with arguments, that program support file association, so i associate it with a file extension, and its works when i double click on file, but problem is that when i try to run that program with my app with argument then that program just run not open that file thats path is in arguments property and second problem is that its not rasing event when that program closed, here is the code i wrote :
Process tmp_process = new Process();
private void Main_Load(object sender, EventArgs e)
{
tmp_process.Exited += new EventHandler(exited_event);
}
private void button1_Click(object sender, EventArgs e)
{
tmp_process.StartInfo.Arguments = @"C:\new folder\abc.ghj";
tmp_process.StartInfo.FileName = @"C:\program.exe";
tmp_process.Start();
}
void exited_event(object sender, EventArgs e)
{
MessageBox.Show("Closed");
}
any solution ? thanks
Edited :
second problem solved after writing this line :
tmp_process.EnableRaisingEvents = true;
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
modified on Friday, May 30, 2008 12:59 PM
|
|
|
|
|
Put the arguments inside of quotes \"\" since it contains a space in the file path
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
thanks man it worked
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|