|
|
LOL!
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
MadDashCoder wrote: for (int i = 100; i <= 10000; i++)
{
if (IsOddNumber(i))
{
OddNumbers.Append(i).Append(comma);
}
}
Why? Iterating just the odd numbers isn't exactly difficult:
for (int i = 101; i < 10000; i += 2)
{
OddNumbers.Append(i).Append(comma);
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I've got an oddball issue I'm troubleshooting. I have a heavy duty data exchange service (windows service hosted in a data center) currently routing data requests from about 120 clients. Any individual client has about 5-15 other clients able to query them. At any given time around 100 or so will be connected, each with a single socket to the exchange service. Most client connection come in from the internet (a few are also hosted at the same data center).
The behaviour I'm observing is that frequently the service will carry out a formal disconnect (exchange terminate messages, and then close the socket) from the client after being connected for less than 10 seconds. Tracking it down I've identified the problem to the EndRead method below. I have the socket managed by custom implementation of Stream.
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) {
if (null != _socket && _socket.Connected)
return _socket.BeginReceive(buffer, offset, count, SocketFlags.None, callback, state);
else
return null;
}
public override int EndRead(IAsyncResult asyncResult) {
int result = -1;
if (null != _socket && _socket.Connected) {
try { result = _socket.EndReceive(asyncResult); } catch (ObjectDisposedException) { }
}
return result;
}
One of two things are happening (my logging didn't track which). Either _socket.Connected is false, or _socket.EndReceive is throwing ObjectDisposedException, since -1 is returned.
Wireshark captures from both the server and client sides show no FIN or RST was ever sent by the client prior to the formal disconnect, instead the disconnect is incidentally caused by Dispose logic once the read fails. Since the connection is in fact still active the terminate message is sent and responded to. If any other exception was thrown it would have been captured and logged. The read that fails is the first of 3 reads for a complete message (being Header, payload length and payload), nor does the Wireshark trace show any message attempted immediately before the disconnect. The last client message was appropriately responded to by the service.
Any one have any hints on where to go hunting for answers?
Addendum: This is TCP.
modified 17-Mar-16 15:54pm.
|
|
|
|
|
Some things to look into.
1. Is there a read timeout on (possibly some) of the sockets?
2. Is the socket (_socket) used in EndRead guaranteed to be the same as the one that started the read. MSDN recommends embedding the socket in the parameter passed in to EndRead.
3. Check whether the thread that issues the read is still running - (From MSDN) All I/O initiated by a given thread is canceled when that thread exits. A pending asynchronous operation can fail if the thread exits before the operation completes.
If that fails the .NET framework can do network tracing on these commands.
NOTE: The EndRecieve method is not guaranteed to return all of the data requested. You may need to request more data.
Best of luck.
|
|
|
|
|
Eventually (via Wireshark) identified a rogue client side process connecting that used the same client ID ... which caused my service to disconnect any connections with that ID ... d'oh!
Still not sure how that's happening from the client, but at least I'm not going mad!
|
|
|
|
|
Hi/Hello!
I am working on Final year project.I amm developing a website database editor.I have created many tables in the database e.g user ,table field ,database etc.I want when i click on button create table then this dialog box open,like this kind of dialog box ,here is image link
http:
Can any one help me plz,I am beginner I don't know how to generate this kind of window.Thanks
Please provide me links or other resources e.g video etc.Thanks CODE PROJECT
|
|
|
|
|
Make your mind up:
Hameed Khan wrote: I am working on Final year project
Hameed Khan wrote: I am beginner
The two do not go well together!
All that is, is a simple form with controls dropped on it!.
To create and display it, right click your Project in Visual Studio, and select "Add"..."Windows Form"
Give it a sensible name (frmDetail perhaps) and click the "Add" button.
Drag controls from the tool box onto your form.
In the Code View, add properties to fill the textboxes.
Now go back to your main form and handle a button click event.
Add the following code:
frmDetail detail = new frmDetail();
if (frmDetail.ShowDialog == DialogResult.OK)
{
}
But if you don't know how to do that...I don't hold out a lot of hope for your final year project!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
OriginalGriff wrote: select "Add"..."Windows Form"
That won't work so well in an ASP.NET project.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Picky, picky, picky!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Where are you stuck?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Use a modal dialog framework. jQuery UI has one but there are others. Some show a different page in an iframe inside the modal, some let you put a div on a page with your controls and the div is shown in the modal, some let you do both. Google for "jquery modal dialog" and you'll find lots of examples and plug-ins. Go through them and pick the one you like.
|
|
|
|
|
Anyone knows how to make something like this?
Ex.(just an example)
When you're copying files from one place to another, a window shows up and a loading bar with an estimated time elapse appear.
How to make the time elapse work with the loading bar. Thanks
|
|
|
|
|
Are you talking about a Progress Bar / Control ?
|
|
|
|
|
Yes? Just like the loading bar. i don't know what it's called, All i know is it looks like loading bar. But i want it to have a time elapse underneath it so that I know how long will it takes to finish.
|
|
|
|
|
Aelmfr wrote: Anyone knows how to make something like this?
Ex.(just an example)
Asking questions is a skill[^]
Elementary school problem :
If it take 1 minute to copy 10% of a file.
- How long does it take to copy the whole file ?
- How long will it take to finish copying the file ?
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
hmm... Yea just like that. Sorry. In C# it's easy to create loading bar there even if i don't have a background in it, But i don't know how to create the (How long will it take to finish copying the file ?) time elapse of it. Hope you can help me.
|
|
|
|
|
Nooo, seriously. Try to answer this problem and figure out the maths under it .
Elementary school problem :
It already took 1 minute to copy 10% of a file.
- How long does it take to copy the whole file ?
- How long will it take to finish copying the file ?
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
oh you never said it. i thought you're giving another example for my situation. if my problem is something like that.
well, if a minute is 10%, then it'll take 10minutes for a whole file.
so 10mins? Hmm... not sure what to do with this? I'm not very good at maths and of all, not a programmer. i just use c# because of its drag n drop environment.
|
|
|
|
|
TimeToSendfile= Timespend * FileSize /FilePartSent
TimeRemaining= TimeToSendFile - Timespend
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
at time=0, the time required to copy a file may as well be a guess ... one doesnt know how long it will take until you've had a couple of 'segments/parts' copied that you can then use to provide finer timing details
(which as a discussion on SO and Raymond Chen indicated about 'Explorer', are guesstimates anyway)
|
|
|
|
|
Garth J Lancaster wrote: at time=0, the time required to copy a file may as well be a guess ... one doesnt know how long it will take until you've had a couple of 'segments/parts' copied that you can then use to provide finer timing details That's why you don't estimate remaining time until a minimum amount of data is sent.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
ppolymorphe wrote: If it take 1 minute to copy 10% of a file.
- How long does it take to copy the whole file ?
- How long will it take to finish copying the file ?
Obligatory XKCD[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
load images in an array in memory, build a timer (there are controls for that) and load the next image to the control when timer has elapsed.
that should get you started. Note that this is by definition multithreaded, which is always fun...
|
|
|
|