For Programmers: Free Programming Magazines  


Home > Archive > C# .NET > April 2004 > Stroring Method in Hashtable









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Stroring Method in Hashtable
Rahil Shah

2004-04-05, 5:33 pm

Hello Everybody:
I am creating a client server application Asynchronously. I want to store the BeginAccept method in a Hashtable. But I am getting errors. Can anyone guide me what is wrong and how to store it in a hashtable.

Thanks,

Rahil

Socket sckt= m_socListener.BeginAccept(new AsyncCallback ( OnClientConnect ),null);

sockettable.Add(connectId, sckt);

The error I am getting is

Cannot implicitly convert type 'System.IAsyncResult' to 'System.Net.Sockets.Socket'

Pls guide what to do..

Rahil


Jon Skeet [C# MVP]

2004-04-05, 6:39 pm

Rahil Shah <anonymous@discussions.microsoft.com> wrote:
> I am creating a client server application Asynchronously. I want to
> store the BeginAccept method in a Hashtable. But I am getting errors.
> Can anyone guide me what is wrong and how to store it in a hashtable.


The problem is that BeginAccept doesn't return a Socket, it returns an
IAsyncResult. I'm not sure exactly what you mean by wanting to store
"the BeginAccept method" in the Hashtable, but that's why your code
isn't compiling.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com