|
Are you using synchronous or asynchronous sockets ?
If it's synchronous, then you just do .Send or .Receive, and when the call returns, that's because it's done! (or failed miserably by the way).
If it's asynchronous, you've got the IAsyncResult interface to subscribe for. More info here[^].
|
|
|
|
|
Thank you so much.. examples... oman!!
Was going insane seriously..
Thanks again a million times.
Sincerely,
Stephen.
|
|
|
|
|
You need to add some control protocol to the stream.
Very simple would be send a fixed number of bytes that contain the size of the object first, let the reciver read that, then read that number of bytes from the stream, then repeat. I do not suggest that you do something this simple in real life though, buu you get the picture?
Stephen.
|
|
|
|
|
im intresting in creating a chat programm using asyc transfer methods (no blocking... multiple clients can connect at the same time) can anyone point me in a good direction... im total newbie too net apps...so start easy.... ie dont throw me into the lions den.
thanks alot
jesse M.
|
|
|
|
|
I have seem plenty of these types of applications included with the freely downloadable source code with C# books. Have a look on wrox.com.
Who is this miscrosoft, and what devilish plans have they for us?
|
|
|
|
|
so ill work on one..and send you the souce...and then you comment with some improvments ?? if thats okay...(i got your email from when you wrote me earlyer..);
|
|
|
|
|
|
I have a method inside a class, method is called PopulateFiles()... it builds a string array of files in a given local directory and then adds the strings to a Treeview. The method works well using tha following statement:
string[] stringFiles = Directory.GetFiles(getFullPath(nodeCurrent.FullPath));
I needed to see if I could also get a similar listing for a network directory, so as a test, I copied the statement and put it below the first, like this:
string strPath = @"\\S4\msdn\";
string[] stringFilesNet = Directory.GetFiles(strPath));
So it's really just a duplicate of the first statement, except the variable name is different, and the GetFiles parameter is a quoted string instead of an inline call to another method. It all compiles and builds fine.
Problem is that when I attempt to do a quickwatch on stringFilesNet, it says "error:identifier 'stringFilesNet' out of scope"...
why would it be out of scope ?
|
|
|
|
|
vlusardi wrote:
Problem is that when I attempt to do a quickwatch on stringFilesNet, it says "error:identifier 'stringFilesNet' out of scope"...
Easily reproduced. It becomes out of scope as soon as you are paused on a breakpoint placed outside the braces enclosing the stringFilesNet variable.
|
|
|
|
|
I guess I'm wondering why the first statement would not be out of scope, then...??? I get valid values for the first statement, but an error on the second... I'm able to do quick watch on the first variable with no problems.
In fact, if I add both to my watch window, and then step past both statements in the debugger, the first variable is valid and the second says "out of scope"... I'm clueless... thanks for your input...
|
|
|
|
|
figured it out...
Reason it was outa scope is because it wasn’t being used elsewhere in the code… technically, it makes sense cuz if it’s not used anywhere other than on the line where the variable is assigned a value, it goes outa scope as soon as you leave that line… ok I’m over it… thanks again for the input
Vince
|
|
|
|
|
Hi,
Okay I am trying to serialize a class and throw it into a MemoryStream so that I can send it from my client to server.
ie..
MemoryStream ms = new MemoryStream(ByteBuffer,0,iRead);
BinaryFormatter b = new BinaryFormatter();
b.Serialize(ms, m_User);
My problem is I don't know how big my serialized class is going to be before I start, which means I don't have iRead.
Could someone help me out with this...
Thanks.
|
|
|
|
|
CodePuppet wrote:
MemoryStream ms = new MemoryStream(ByteBuffer,0,iRead);
You are using one of the non-resizable MemoryStream constructors. Why not use new MemoryStream() instead, and then adjust the capacity with a simple .SetLength() .
Serialization itself[^]. (the tutorial uses a FileStream, but that's not an issue since both FileStream and MemoryStream are IO.Stream derived classes).
|
|
|
|
|
Hi all,
This might be a very easy question and a commen topic and I know there is a lot of info on it but I could not find a single tutorial or artical for creating and using a dll in Dev-C++, I am using the latest version 5.0 beta 7 (4.9.7.0). I know there is a project template type dll to select and most of the code is ready but I can't understand it and there is nothing written in the help documents. And the worst part is there is nothing on how to use the compiled dll . The reason why I choose Dev-C++ for my dll is becouse I love it and it is so easy to use, except for this part maybe , and I have already written the program that the dll is for in Dev-C++. I heard on the site www.functionx.com/visualc/applications/staticdll.htm from FunctionX that dlls compiled in Visual C++ can't simply be "plugged" in programs written in Dev-C++ and Borland C++, is that true? And how do I use and create a dll in Dev-C++?
Aidman » over and out
|
|
|
|
|
|
Where else should I post this topic? Everything else seems to be related to Visual C++...
Aidman » over and out
|
|
|
|
|
|
Hmm... But Dev-C++ is a diffrent compiler... ok I will try
Aidman » over and out
|
|
|
|
|
I am sure that .Net was sent to drive us all insane.
I have a data grid bound to a datatable in a dataset.
I have a label that displays the number of items in the grid, or shall we say it should
I wanted to update the row count in response to RowChanged and RowDeleted, just set the label equal to DataTable.Rows.Count. But no, thats not updated until after the event has fired.
Are there any events in DataTable, DataSet, DataView or anything else that fires _after_ the row count has been updated?
Looks like I have to put some convulted logic in there to work out what the user is doing
Thanks
Stephen.
|
|
|
|
|
The order of events being triggered are as follows :
- RowChanging
- RecordStateChanged
- RowChanged
- and only then the Rows.Count value is updated (!) ( this.Rows.ArrayAdd(row); )
Since DataRowCollection (what you get with this.Rows) is an internal class, and on the other hand the collection itself (ArrayList) doesn't trigger any event when objects are added, updated or removed, I am afraid you are a bit bound to rely on code like this :
- make sure to subscribe for all RowChanged events.
- make sure to read the DataRawChangedEventArgs .Action property passed along with it, and check for one of these actions {Add, Change, Commit, Delete, Nothing, Rollback}.
- then, from the current Row Count value, and this action, just try to guess the final Row Count value. (*)
- alternatively to (*), create a short life timer in your RowChanged event handler and let it go. Then get the actual Row Count value when the timer signals.
|
|
|
|
|
Thanks for that, I had come to the same conclusion, but it's good to hear it from someone else.
I wounder if any of this behaviour has changed in V1.1 of the framework?
Stephen.
|
|
|
|
|
I have a panel and label whos click event points to the same event handler
How do I
1) Work out if the sender was a panel or a label
2) if the label is the child of the panel (i.e. lbl.Parent = PanelX;)
how can I get the parent of the label so that I can work on it.
private void button1_Click(object sender, System.EventArgs e)
{
Panel abtn = (Panel)sender;
// what if the sender was the label not the panel
// How do I get to the Panel
if (prevbtn != abtn)
{
prevbtn = abtn;
}
}
|
|
|
|
|
if (sender is Panel)
{
Panel panel = (Panel)sender;
}
else
{
Label label = (Label)sender;
Panel parent = (Panel)label.Parent;
}
please note that i am presuming that when the label is added to the controls collection, its parent parameter is automatically set.
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
Cheers, works a treat
Satvinder
|
|
|
|
|
Hello people
I am having a small problem getting my UI to work the way I would like it too, basically I need to display a list of items that is generated during the application runtime. There are two ways I can do this but I have problems with both, a solution or suggestion for either would be greatly appreciated :
1) Textbox
How can you get a Textbox to scroll to its last line? i.e. displaying the last line added to the control via .AppendText (setting focus using .focus & .ScrolltoCaret doesnt work)
2) Listbox
How can you permanently disable the vertical scrollbar on the listbox?
EDIT : In an ideal world I would prefer to use a listbox with all scrollbars disabled but I cannot find any docs about this. With regards to the textbox problem it would seem this is an MS "feature" :
http://www.dotnet247.com/247reference/msgs/5/25733.aspx
|
|
|
|