CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2010
    Posts
    42

    C# Relationship between class and socket

    Can't really explain the situation in the best words but here is what I am dealing with.

    I have a loop that cycles through the following code:

    Code:
    public IList<Socket> Select(ICollection<Socket> listeners)
            {
                var tcpListeners = new List<Socket>(from listener in listeners
                                                         where listener.Poll(-1, SelectMode.SelectRead)
                                                         select listener);
    
                
                return tcpListeners;
            }
    All connections that wont block the socket (that are ready to be read from) are added to a list. Then I have a foreach loop that cycles through the sockets to read from each one and process it. Say I have a class Connection that has data in it related to that specific socket. The class is initiated with the socket. How do I pull up the right class with the socket so I can pull information from it?
    Last edited by Mastermosley; July 28th, 2011 at 03:40 PM.

  2. #2
    Join Date
    Nov 2010
    Posts
    42

    Re: C# Relationship between class and socket

    Okay nevermind I solved it by making a Connection list and checking each connection class socket.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured