|
Hi!
Seems as if you got more than 1K of data reaching the port you're listening to.
Try increasing buff to 4K and see if it's getting better.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
mav is right, your buffer is too small.
there is a maximum packet size for TCP/IP (IIRD it is around 1500 B)
and there is one for UDP, but I dont recall, might be the same number.
Your buffer should be large enough to contain such packet.
|
|
|
|
|
Hi Luc!
Just to clear things up: I think you refer to the MTU, not the maximum packet size for TCP/IP.
The MTU (maximum transfer unit) is the largest chunk of data that can be transmitted unfragmented. For Ethernet, this is 1500 bytes (this leaves 1472 bytes of data for UDP because of 20 bytes of IP header and 8 bytes of UDP header).
Once the amount of data to send is larger than this, it's split into single, smaller packets and transmitted separately. IP then reassembles the packets automatically so that you can have UDP packets with > 1472 bytes of data.
I found a quite extensive overview of TCP/IP here[^], just in case you're interested.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi mav, yes that's what was simmering in my memory.
So there would be no maximum size at all ?
|
|
|
|
|
There is a maximum size, but it depends on the system you're working with; the way the TCP/IP stack is implemented.
I think the absolute maximum will be 64K, but I've read that Sun machines only can handle 32K.
But that's a rather theoretical limit because if you use such large UDP packets they are split into many single packages and if only a single packet gets altered or lost, the whole UDP datagram is discarded because it cannot be reassembled correctly.
So you should keep the data in a single UDP packet as small as possible.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks for the info.
Regards.
|
|
|
|
|
hello,
hello is there anyway i can use ffmpeg to convert an uploaded video through asp.net and csharp n play the converted file..i found 1 way of streaming flv through asp.net what i want is convertion process
aneef
|
|
|
|
|
Is it possible to import a method from a DLL and run it as if it were in the same namespace?
The problem I am running into is this (Application = CA2, DLL = AnyDLL) :
1. CA2 references AnyDLL and invokes method in AnyDLL.
2. Method in AnyDLL tries to use GetType to get a class in CA2.
3. Exception happens because the DLL can't see the class in CA2.
Is there any way around this? I would think many different times a person would want to use a method in a DLL as if the code for the method was right there and not in the DLL?
Any help is much appreaciated! 
|
|
|
|
|
Don't repost the same question so close after the first.
---
single minded; short sighted; long gone;
|
|
|
|
|
Taicho2k wrote: 1. CA2 references AnyDLL and invokes method in AnyDLL.
2. Method in AnyDLL tries to use GetType to get a class in CA2.
3. Exception happens because the DLL can't see the class in CA2.
Is there any way around this? I would think many different times a person would want to use a method in a DLL as if the code for the method was right there and not in the DLL?
Yeah, does sound like a circular reference. I try to avoid circular references like the plague. My advice would be to factor out the class in your executable to a second assembly. Then the first assembly can reference the second one to access the class. The executable can reference both assemblies to use the classes/methods it needs. This breaks the circular reference and makes things easier to manage and understand.
|
|
|
|
|
CA2 references AnyDLL and AnyDLL references CA2? What you have is a circle reference and not a very good design. You either need to redesign or do a better job of explaining what you are trying to do, or want to do.
only two letters away from being an asset
|
|
|
|
|
Thanks for the replies everyone, I'm probably not explaining myself too well...the method I am trying to use from my dll is a method that uses System.Reflection to be able to run any other method by using a string so when I say that the method in AnyDLL is referencing a method in my application pretend that the method could be referencing any method in any other application...essentially I am just trying to get the method in the DLL to run as if it were running directly in the application and not contained in some DLL...is that even possible? I was experimenting w/ DllImport and now I've begun playing around w/ Assembly.LoadFrom("dllname") thanks to an earlier suggestion... any more ideas? 
|
|
|
|
|
Hi,
some info, not a full solution tho:
- you need DllImport to call unmanaged (i.e. native) code (that resides in a dll)
from managed code (say C# that resides in an exe or another dll), and nowhere else;
if everything is managed, then NO DllImport.
- you can distribute managed code over as many DLL files you want, it does not
really matter; if it needs to bind at run-time (as with reflection), then your
code must find the right DLL; finding the class and member/method inside it
is independent of the EXE/DLL where they reside.
SO my suggestion is: first try to have an EXE perform reflection on itself;
only when you get that working, move the reflecting code to another DLL and
make it work again.
|
|
|
|
|
Hello,
I have a confusion about the word delegate. can any body clarify my doubts...what is delegate ? what's the use for that...please give some sample code for that ..please help me..
alex.
|
|
|
|
|
|
Malayil alex wrote: can any body clarify my doubts...what is delegate
A lot of people actually did explain it:
Search result on CP[^]
All the best,
Martin
|
|
|
|
|
Hi,
if you happen to be familiar with some other programming languages, such as C:
a delegate is very much like a function pointer.
It has one extra twist: it also holds a reference to an object (an instance of
the class that holds the methods code), so a delegate knows which method to invoke on which object.
So if you create a delegate inside object FOO to call method BAR, and then
execute that delegate, it will behave as is you were calling FOO.BAR directly.
BTW if BAR is a static method, FOO would be the class itself, and not an
instance of the class.
|
|
|
|
|
A delegate declaration defines a reference type that can be used to encapsulate a method with a specific signature. A delegate instance encapsulates a static or an instance method. Delegates are roughly similar to function pointers in C++; however, delegates are type-safe and secure.
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|
|
You haven't added anything of value. Did you read the other replies that were posted 9 hours before you? Did you happen to see the links to more information than you have provided here? Stop spamming, add value.
only two letters away from being an asset
|
|
|
|
|
Ok so here's the problem....
I have a solution that contains 2 projects one is the executable and the other is a DLL that I wrote that the application uses... the problem is that method I am using from the dll tries to reference a class and/or method from the application but since it isn't referenced I get an error here is the code:
Application code:
AnyMethod.RunMethod("ProcessModules","Menu"); //ProcessModules being a class in the application.
DLL code:
public static void RunMethod(string myClass, string myMethod)
{
Type myType = Type.GetType(myClass);
MethodInfo myMeth = myType.GetMethod(myMethod);
myMeth.Invoke(null,null);
}
Any ideas? I have a feeling this would use some inheritance feature or something but not sure...still very new to C#...There has to be a way the dll can reference a class in my other namespace without having to hard-code the reference right??
|
|
|
|
|
Taicho2k wrote: still very new to C#
Then why are you trying to invoke methods from string class names and method names? That is a semi advanced topic.
Taicho2k wrote: I have a feeling this would use some inheritance feature or something but not sure
It would be better if you understood fundamentals like that before moving on to advanced topics.
|
|
|
|
|
Because I am experimenting with Reflection...If you could offer up any hints that would be much more helpful than trying to dictate what topics I should research...if I was to solve this problem then that would be a step towards the direction of learning and understanding this topic better...
|
|
|
|
|
Taicho2k wrote: Because I am experimenting with Reflection
Then google for it, there are a multitude of examples
Taicho2k wrote: trying to dictate what topics I should research
Sorry didn't get any feeling he was trying to dictate to you, just addressing some valuable points for you. There was no justification for you voting him down. Did it get you any closer to finding an answer?
only two letters away from being an asset
|
|
|
|
|
Taicho2k wrote: If you could offer up any hints
did that
led mike wrote: It would be better if you understood fundamentals like that before moving on to advanced topics.
I can't help you further if you are going to choose to ignore it.
Taicho2k wrote: trying to dictate what topics I should research
You asked for help I didn't, if you don't like what I offered as advice don't respond. As to your criticism of my "free advice", f*** off.
|
|
|
|
|
You're the kind of people that make people shy away from using forums- let us take the following example:
I ask (trusting that someone with your wisdom in this language will help me, offer a hint in the right direction, or give an example):
What is 2+2.
You say:
It would be better if you understood what addition is before moving on to advanced topics.
I can understand that understanding these topics better would help me, that's why I'm here. The method in the code I posted works fine from within the same namespace just when I make it into a DLL and try and use it and the arguments reference a class and method from outside the DLL it doesn't work, so I guess what I need to do is figure out how to make the dll see the class or namespace that is calling the method from within it...if you can help me and offer up anything that is actually considered help it would be much appreciated.
I also understand that I am probably not explaning this very well, but what I am looking for is someone who has run into a similiar problem and what their solution was for it.
|
|
|
|