|
How exactly are you determining that they are "out of order"?
|
|
|
|
|
To be more precise, instead of saying the packets are out of order, I'll say that the receives are completing out of order.
I'm using a log file to record each packet as it is processed by the completion routine.
I have a receive buffer of 1024 bytes, and the full message is about 7200 bytes. When one of the receives is processed out of order, the message becomes corrupted and the deserialization fails.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Some possibilities.
You are ignoring the read count.
You are not reading the entire set of data.
What is arriving is 'incorrect' (thus the sender is the problem.)
You don't have an actual size so you are hoping that 'about 7200' can be figured out via deserialization and that isn't a good idea.
|
|
|
|
|
Thanks for your thoughts. I was able to solve the issue for now by using a variable-length receive buffer.
I calculate how many bytes are left in the message, and adjust the buffer to be big enough to handle it in one go. That way, there is no chance for anything to get out of order.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hello all,
While working on a project that emails files with international filenames, I've come across an unusual issue. if I attach with a US-ASCII filename only, I can get better than 200 characters long without errors.
If I include an extended character, it encodes in UTF-8 and the length before it gets funky is very small (< 40 characters). To define funky.. here's an example filename after it goes bad:
=utf-8BSU5GT1JNw4FUSUNBX0ltcGFjdF9Bc3Nl
it looks like UTF8 encoded string with a UTF-8 decoding instruction or a mime boundary... not sure which.
Has anyone seen this before -- and what are the rules / limitations of filenames -- I tried emailing the file by hand through outlook and it handles it, so I don't think it is a MIME specific limitation.
Sample code:
class Program
{
private const string DOMAIN = "foobar.com";
private const string SMTPHOST = "mail." + DOMAIN;
private const string FROM = "chadwick.posey@" + DOMAIN;
private const string TO = FROM;
static void Main(string[] args)
{
MailMessage msg = new MailMessage(FROM, TO, "Subject", "Body");
string path = Path.GetTempPath();
string name = "AAAAAA_AAAAAAAAAAAA_AAAAAAA_AAAA - IIIIIII CCCCCCCCCC DD IIIIIIÁIIII_20111018_091327.pptx";
File.WriteAllText(path + "\\" + name, "blah");
Attachment att = new Attachment(path + "\\" + name, new ContentType("application/vnd.openxmlformats-officedocument.presentationml.presentation"));
msg.Attachments.Add(att);
SmtpClient client = new SmtpClient(SMTPHOST, 25);
client.Send(msg);
}
}
I've tried (so far) -- setting the encoding for the attachment.NameEncoding to UTF8 and UTF32, neither worked. Setting the ContentDisposition.FileName on the attachment fails because it is not using US-ASCII characters only.
Any suggestions on how to get it to include the full filename with the accent / extended characters in tact?
Thanks
Chadwick
=============================
I'm a developer, he's a developer, she's a developer, Wouldn't ya like to be a developer too?
|
|
|
|
|
Chadwick Posey wrote: and what are the rules / limitations of filenames
Long filenames under Windows can be upto 255 UTF16 characters. (Source[^])
Lots of older apps (and drivers) will still be using the MAX_PATH value and coding everything in ASCII, cutting back your effective storage-space.
Chadwick Posey wrote: Any suggestions on how to get it to include the full filename with the accent / extended characters in tact?
Is it an option to archive the files in a ZIP-file and to attach that? I'm not sure whether it would work, but it'd be the first alternative that I'd go for.
Bastard Programmer from Hell
|
|
|
|
|
I will definitely look into that... optimally I'd like to send the bare file with the name intact, but this will be my last resort option I think.
I figured even if the filename length was 255 with single byte characters, that it would support 128 or so with double byte characters, but it is significantly less... I think at 36 characters (72 bytes) it starts exhibiting the strange behavior... I'm wondering if the whole MIME-wrapping thing (I think the mime source is limited to 75 characters wide or something) is throwing something off if it is in UTF-8.
Thanks
Chadwick
=============================
I'm a developer, he's a developer, she's a developer, Wouldn't ya like to be a developer too?
|
|
|
|
|
For posterity, I'm including my findings here -- I believe it to be a bug with .NET, and have submitted as such to connect here:
Microsoft Connect[^]
It appears to stem from the way encoded headers are wrapped. if the filename length exceeds a certain number of bytes when encoded, the system double-encodes the filename for some reason... Odd...
Hope they fix it... if anyone can please test the sample code I uploaded to Microsoft and verify it fails, I would greatly appreciate the help.
=================================================
Update: We worked around the issue by zipping the file using ASCII characters. It has been patched in a .NET 4 Framework Hotfix available here:
Microsoft Connect Download[^]
=============================
I'm a developer, he's a developer, she's a developer, Wouldn't ya like to be a developer too?
modified 21-Feb-12 15:12pm.
|
|
|
|
|
hi, I'm sending text+numbers from a wcf client to a wcf server in a multidimensional array. The data arrives but if I'm sending eg. "4 Drinks" it arrives as "1 Drinks" (what ever the number is, it arrives as 1) This happens frequently and sometimes it arrives without any change.
I tried a special class instead of array but it's the same. So I think WCF has a problem.
The question is:
-Do I need to use message security to solve it? Or your recommendation?
- if yes, does mes.security have bad impact on performance?
Thanks for reading, would appreciate if answered
|
|
|
|
|
teknolog123 wrote: I tried a special class instead of array but it's the same. So I think WCF has a problem.
Doubtful.
I suggest that you look at your code - at both ends - and see what is happening. I seriously doubt that a bug that severe would still be unnoticed (let alone unfixed) after this long.
Without the relevant code fragments, we can really do no more...
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
3 out of 4 drinks disappearing? on a Friday? is he using a British carrier? Have the regular "so long suckers" messages popped up in the Lounge yet?
|
|
|
|
|
I'll have you know Nagy is Hungarian!
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
sounds like a loose network conntection... check the floor behind the computer and I bet you will spilled drinks all over the place.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
|
Use a tool like Fiddler to look at the web service request and response.
It should give you a fair idea where your problem lies.
|
|
|
|
|
How to make the program do not minimized at all minimized windows?
|
|
|
|
|
There are two ways:
1)from the main form's property window MinimizeBox to set the property false
2)on load event of the main form put these two lines of code:
this.WindowState = FormWindowState.Maximized;
this.MinimizeBox = false;
Regards
Qendro
|
|
|
|
|
If Ctrl + Win, (minimize all windows)?
|
|
|
|
|
That's used to show the desktop; it'd be very frustrating for a user if he/she can't reach their desktop. There's also a minor difference[^] between "Minimize All" (Win-L) and "Show Desktop" (Win-D).
Bastard Programmer from Hell
|
|
|
|
|
I totally agree with You my friend...I also think that is very frustrating for the user to prevent from "Show Desktop" feature...
Qendro
|
|
|
|
|
Eddy Vluggen wrote:"Minimize All" (Win-L) Interesting: on my Win 7 Pro machine, Win-L switches me to the log-in screen where I could, potentially, switch users, and where I have to click on my current user icon to return to "normal use" mode.
best, Bill
"Last year I went fishing with Salvador Dali. He was using a dotted
line. He caught every other fish." Steven Wright
|
|
|
|
|
BillWoodruff wrote: Interesting: on my Win 7 Pro machine, Win-L switches me to the log-in screen where I could, potentially, switch users, and where I have to click on my current user icon to return to "normal use" mode.
Not interesting, merely a typo. Win-M does a minimize all, Win-D shows the desktop.
Bastard Programmer from Hell
|
|
|
|
|
Eddy Vluggen wrote: merely a typo My faith in you remains unshaken !
Win-Shift-M will restore all the Windows minimized by Win-M.
And a second Win-D will also restore.
All of which I gleaned from the excellent link you provided, thanks.
best, Bill
"Last year I went fishing with Salvador Dali. He was using a dotted
line. He caught every other fish." Steven Wright
|
|
|
|
|
Hehe, thanks
|
|
|
|
|
Google Result[^]
Here is a google search result, I saw there are few solutions.
I Love T-SQL
"VB.NET is developed with C#.NET"
If my post helps you kindly save my time by voting my post.
|
|
|
|