|
Yes, this is the exception:
System.Net.Sockets.SocketException: The attempted operation is not supported for
the type of object referenced
at System.Net.Sockets.Socket.Listen(Int32 backlog)
at AsynchronousSocketListener.StartListening() in d:\projects\asyncsock\server\server.cs:line 49 The socket is created like this:
Socket listener = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp); Thanks,
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|
|
From what I remember, UDP is a connectionless protocol. Unlike TCP, UDP has no notion of an explicit 'connection' being made to a server socket, which is most likely why this exception is being thrown.
TCP is designed to guaruntee data delivery or to notify the sender and receiver of a delivery failure. In order to do this it keeps alot of state behind the scenes, thus necessitating the 'connection' metaphor.
UDP, however, is much more like IP in that it is a "best effort" delivery protocol. If you send data over UDP, it will most likely get their in good shape. However, it's up to the person reading from the UDP stream to figure out whether or not the data they got has been corrupted.
Long story short - there is no such thing as a 'Connection' or a 'Listen socket' in UDP. If you want to send a data packet via UDP, you specify the data you want to send along with the IP address and port # you want to send it to. You do this for every send() call. Same type of thing with receive() on UDP. You don't connect to a server socket like you would with TCP, you just recv() on a specific port # and wait for someone to send a UDP packet to that port.
My only experience with writing UDP code is in straight C on Unix, so I'm not sure how this would be implemented in the .NET FCL...
--
Russell Morris
"Have you gone mad Frink? Put down that science pole!"
|
|
|
|
|
Russell Morris wrote:
You don't connect to a server socket like you would with TCP, you just recv() on a specific port # and wait for someone to send a UDP packet to that port.
So, that is why there is no UdpListener class?? For an UDP server I just start an UdpClient class and call receive on certain port, and it will block until some one calls send on that port?
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|
|
My application needs to support multiple displays. How do I programmaticly move a window/form to a certain displays (monitor)?
If I need to do this with win32 api, what would be the function?
|
|
|
|
|
As long as child forms can move outside the main window, it should have multiple monitor support.
I did note somewhere (cant remember where though) than the position you use is as if the no.1 monitor is the centre monitor in an imaginart monitor grid.
So in my case, 2nd monitor being on the left, the bottom left corner would be (-1024, 768) top right (0,0). Not so sure though
Hope you understand
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
You should be able to get all the info you need about screen points from the System.Windows.Forms.Screen class
|
|
|
|
|
|
AK wrote:
If I need to do this with win32 api, what would be the function?
I presume you meant to ask this in the C++ forum ? If you're asking about C#, you don't need the API at all. Check out James' and my Code Project screensaver, it supports multimonitor in C#.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
What I basicly needed was to get the a form to show up on all the displays center on the screen. This is what I did:
1. Create a form for every screen.
2. Set the location of the form to the screen points (w/ offset to make it centered)
3. Assign all the events to the same event handler. (So all the forms are uniform)
4. Show all the forms.
5. When I get input from the form - all forms are closed.
Thanks for helping me out.
|
|
|
|
|
There is a setting in windows control panel that allows you to set how fast this happens, i wondered if anyone knew how to discover it, so i am not hard coding it.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
Hi all,
I have implemented a destructor, and although the destructor gets called and I can step thru the functions, there is this one function that does not "respond". It gets called and returns, but does not do (it does nothing) what its meant to do. I can however assign the same function to a button and it works without any problems.
~CD()
{
this.Stop();
_Free();
}
Any suggestions?
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Maybe the resources which Stop function uses are freed before the function is called.
43 68 65 65 72 73 2c
4d 69 63 68 61 65 6c
|
|
|
|
|
Nope, not it, I have tried calling the unmanaged dll directly with the same effect
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
If you post Stop function's code it'll be simplier to come up with a solution.
43 68 65 65 72 73 2c
4d 69 63 68 61 65 6c
|
|
|
|
|
But first do what Nnamdi Onyeyiri advises.
I agree with him.
43 68 65 65 72 73 2c
4d 69 63 68 61 65 6c
|
|
|
|
|
|
I meant I'm a
43 68 65 65 72 73 2c
4d 69 63 68 61 65 6c
|
|
|
|
|
|
I believe you may be referring to this man.
David Stone
But Clinton wasn't a predictable, boring, aging, lying, eloquent, maintainer-of-the-status-quo. He was a predictable, boring-but-trying-to-look-hip, aging-and-fat-but-seemingly-oblivious-to-it, lying-but-in-sadly-blatant-ways, not-eloquent-but-trying-to-make-up-for-it-by-talking-even-more, bringer-in-of-scary-and-potentially-dangerous-new-policies. And there was also Al Gore. It just wasn't *right*.
Shog9
|
|
|
|
|
|
Be careful - the C# destructor is simply a shorthand way of calling the Finalize method that forces it to be written in a try/catch loop. It is NOT guarenteed to run when your object goes out of scope, hence the 'Dispose' paradigm, which is little more than deterministic destruction through a method that you need to remember to call.
I think ( and Jeff Richter agrees ) that calling it a destructor and making it look like a C++ destructor is gay, because it isn't one, and it's confusing that it looks like one.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
Thx Christian
Thats sounds like a lot of "extra useless" work though
How would disposed be called then, automatically? If it not auto, then it defeats the point...
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
leppie wrote:
Thats sounds like a lot of "extra useless" work though
It *is*, except that there is no deterministic finalisation, therefore you need it if you want destruction to happen when an item goes out of scope, or at any other time you choose.
leppie wrote:
How would disposed be called then, automatically?
No, the point is that the system cannot tell when to call it.
leppie wrote:
If it not auto, then it defeats the point...
Sadly, that *is* the point. There is no mechanism whereby a destructor gets called at any specific time, and so you need to abstract the destruction into a function you *can* call, which is the only reason for IDispose, to formalise what is really both obvious and a little sad.
Having said that, the fact that C# moves towards an idiom where try/catch is used more than in C++, because the API's throw Exceptions rather than return error codes, it's really not that hard to have a finally block that handles the cleanup through IDispose, or otherwise. I was a little sad at first, and it still makes things ugly in some cases, but I tend to think now it's more of a paradigm change than an all out disaster. Not like the fact that const is broken in C#.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
I'm using a Class DLL which contains my codes to make it easier for me to update the software with just overwrting the DLL file. Now I need to know how can I use the following command in the clas library?
FORMname.CONTRLname.Text = "Hell World";
Jassim Rahma
|
|
|
|
|