|
A typo in my previous mail is that RTP is a UDP protocol not a TCP
|
|
|
|
|
So what you're saying is that even though I make sure to read 4 bytes off the socket they may not be the correct four bytes so when I cast them it converts into a monstrous integer? The server manages flash clients and everytime someone does a postback or otherwise the flash reloads and then reconnects. I wonder if it has todo with old data sitting on the socket from the previous connection. But I do create a new socket everytime they connect, but maybe it has todo with mono's socket pool code. The Sync Byte, how would I go about about implementing something like that and what is it fixing exactly? Is it implemented something like this?
Socket.Send(0x80+Size+Data);
while(true)
{
if(Socket.Receive(0,1)==0x80)
{
size = BitConverter.ToInt32(Socket.Receive(0, sizeof(int)));
break;
}
}
I'm sorry for all the thinking out loud and questions, this error has caused me tons of headache.
Am I thinking in the right direction with that?
|
|
|
|
|
You got it.
The problem with TCP is you may have a text protocol (HTTP, ...) or binary (RDP - remote desktop...)
If your protocol is too weak you can resync, so you may have or not a control.
Send -->
<-- Ack Or Error
If you want to be sure that the message has been delivery, for instance the ftp protocol does this.
case "REST":
...
break;
default: //We Don't understand the Command
SendMsg("500 Command not understood\r\n",ref outBuffer);
break;
My advise, is read you socket buffer normaly, check at the beginning that you have a signature 0x80 (for instance), if not consume the buffer, and wait for another packet, or another option, search for the sync byte.
On heavy traffic, the tcp stack may overloaded, in this case you may have in your buffer.
First Read
0x80 xx xx xx xx 0x80
Second Read
xx xx xx xx 0x80 xx
Third Read
xx xx xx 0x80 xx xx
....
You can mark the start and the stop of your packet, start with a 0x80 and then get the size (which gives the size), you can break and split you data, and consume. Place your uncomplete packet in a waiting queue, and wait for the following one. When received, add it to the end, check that the size matches the new packet, if not drop it and resync.
A bit complex at the beginning, but I can insure that it works fine in all cases. Trust me I work in the telcom area, I know what is TCP over load... thanks to the Apple phone
|
|
|
|
|
Hi
I've C# Windows which has some message box to prompt some info. I'm trying to invoke this from DOS (batch file) at that time i just want to skip all the prompt message boxes. Is there anyways to do it from DOS?
Thanks
|
|
|
|
|
Would you mind providing more clarification?
Are you trying to invoke an existing application (.exe) from a DOS batch file. Or are you invoking a method within the program.
|
|
|
|
|
Im trying to access existing application from DOS. Exactly saying am trying to create virtual directory using the following commands
cd C:\WINDOWS\system32
IISVDir.vbs
IIsVDir /create "Default Web Site" App C:\Inetpub\wwwroot\App
IIsVDir /create "Default Web Site" AppService C:\Inetpub\wwwroot\AppService
IIsVDir /create "Default Web Site" ServiceRequest C:\Inetpub\wwwroot\ServiceRequest
But for every line it asks confirmation so Im just trying to automate it with some predefined parameters.
Thanks ....
|
|
|
|
|
If I understand correctly you're trying to close 'popups' that appear from another application, right?
In that case you'll need to import some windows dll's (winapi) (I think you'll need the user32.dll, but I'm not sure) that expose the Windows functions like FindWindows, GetDlgText, etc... With those functions you'll need to:
1: Find the correct window (probably need a loop that will redo this every x seconds)
2: if window is open (= encountered in step 1), press the button (Yes, No, OK, Cancel) I don't know the exact function for this, but it exists. avoid closing or killing the msgbox, instead try to let the msgbox handle itself by using one of the closing buttons.
You'll have to find the correct functions and signatures on MSDN, but there is a lot of info out there about this topic.
|
|
|
|
|
Hi,
I am having custome Link List object.
Which manages nodes and searching using while loop (node.next()).
I am new to Linq
Is Linq can be used with my Link List object to avoid loops?
Thanks Regards
Khaniya Sunil
|
|
|
|
|
If I understand your question correct - yes, you can use Linq to search a List<t> (using Linq to Objects). For an example, have a look at this.
Good luck
|
|
|
|
|
hi Calla
Thanks for your response
Actually I am talking about custom Liked List(data structure).
where nodes are connected via reference to each other
We are having reference of only first node.
Thanks
|
|
|
|
|
You can use linq only on those objects which can be treated as a collection of objects.
You can read your link list at a time and store it in a list or array
and then you can apply linq query to them.
|
|
|
|
|
|
is Global variable good or bad in c#.net? If i declare Global variables instant of singleton variables its good or bad for application??
Thanks
Raj
|
|
|
|
|
As a general practice, global variables are bad. This compromises the security of the application, as well as eliminating any chance of data-hiding through the use of objects and variable passing.
Now, this of course depends on the type of information and the use of the program. You may want to use a static global variable for things like links or connection information etc. This means that the variable cannot be changed at any point of from anywhere else in the program though. It will exist as a static reference value.
What are you trying to accomplish with the global variable?
|
|
|
|
|
Eric (eD) wrote: As a general practice, global variables are bad.
Myth. Global variables should generally be avoided when possible (and used as a last resort), but they're not "bad", and there are times when you simply must use one to accomplish some tasks. Besides that, global variables *technically* aren't even possible in .Net.
Eric (eD) wrote: You may want to use a static global variable for things like links or connection information etc. This means that the variable cannot be changed at any point of from anywhere else in the program though.
Not quite. Static members in an object exist for the lifetime of the application, and can be changed from anywhere (and by any other object) if they have the appropriate visibility. In fact, it's common practice to create a static class for just that purpose. In many ways, using static class members can be fraught with as much - if not more than - "global" variables, but like globals, they're pretty damn handy in a pinch, and you shouldn't hesitate to use them if the architecture demands it.
.45 ACP - because shooting twice is just silly ----- "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." - J. Jystad, 2001
|
|
|
|
|
I'd say it is pretty meaningless to say this or that programming practice is inherently good or bad. The only proper answer is always "it depends".
That said, I'm not really sure what you mean by "global variable". C# does not have them. You seem to mean instance members of a singleton. From the language's point of view that's just like any other instance member, the singleton after all is a pattern you can implement with C#, but not a concept that the C# language itself "is aware" of.
In general, if you are using the object-oriented paradigm, it is considered bad practice not to encapsulate state. Therefore, you should expose the state through properties (or methods in a few cases). These may be read-only or read-write, as long as you perform validation to guarantee object state remains valid at all times.
What is your motivation for wanting to use a "global variable"? There may be many ways to accomplish what you seek, such as using static members (which is the closest thing to global variables you can find in C#), thread data, application state (in an asp.net context) or other mechanisms.
|
|
|
|
|
Hi,
I am using VS 2008. My Datagridview is having bounded columns. Datasource is using as DataSet with Binding source.
I wanted to show these as vertical view ( swaping columns to rows)
how can i do? please help me
Ramana
|
|
|
|
|
|
Hi. I want to download a file from one website. It is really simple do it like this:
WebClient wc = new WebClient();
wc.DownloadFile(@"http://aaa.uuu", @"D:\111.gig");
But when a file is attachment... in response we have header: "Content-Disposition: attachment; filename="file.gif"", I couldn`n download file.
I`v seached smth around this problem and sow like this:
string filepath = Server.MapPath("test.doc");
FileInfo file = new FileInfo(filepath);
if (file.Exists)
{
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = ReturnExtension(file.Extension.ToLower());
Response.TransmitFile(file.FullName);
Response.End();
}
The first problem is what i couldn`t use class Response, becouse i couldn`t use System.Web.UI.
Plz, explain me, I couldn`t use System.Web.UI becouse I programming in C# but not in ASP.NET?
And could anybody help me with downloading file, which is attachment?
|
|
|
|
|
hello_amigo wrote: I programming in C# but not in ASP.NET
ASP.NET is a technology, a framework; you can't "program" in it. ASP.NET uses C#, or other lesser languages (VB.NET )
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I am trying to implement multiple dropdown lists with Access Database.
It is like this- I have a dropdown list which takes data of all users from one column in the database and shows them in the dropdown list. Then based on which user is selected, the dropdown list needs to dynamically change its contents to show the tasks related to that user and from this selection of tasks, another dropdown list needs to dynamically change itself to show the actions for that user, and that particular task.
I have not done much coding here since I have added an access datasource and generated the contents from the database into the 1st list but i am not able to take the output from that list and give it as an input to the second list and so on. I have to do it in C# and this is a web application and I am not able to figure it out.
Any help is appreciated.
SJ.
|
|
|
|
|
Don't cross post Pick one forum and use it.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
buddy, the reason i posted in both the forums is that, my topic is related to both .NET and C#. did i post it in C++, php or anything else?????? i did that only because it is related stuff and not for spamming !!!
|
|
|
|
|
|
just so you know, by saying buddy, i was following the 8th point in the link you provided !!!!!!!!
peace buddy
|
|
|
|