Results 1 to 4 of 4

Thread: What's the difference?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Posts
    382

    What's the difference?

    Dealing with Asyncronous Sockets, I am wondering what the difference between these 2 calls are..


    Code:
    Handler.BeginReceive(State.RBuff, 0, State.PacketSize, SocketFlags.None, New AsyncCallback(AddressOf ReceiveLock), State)
    And this one?

    Code:
    Handler.BeginReceive(State.RBuff, 0, State.PacketSize, SocketFlags.None, AddressOf ReceiveLock, State)
    They are both Asyncronous calls, I see some examples that use the "New AsyncCallback(AddressOf Method)" and some I just see "AddressOf Method", Is there any signifigant different? I tried both ways and they both seem to operate the same..

    Just wondering

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    They are not different i guess. They are two ways of declaring delegates.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  3. #3
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256

    Re: What's the difference?

    Originally posted by Hinder
    Dealing with Asyncronous Sockets, I am wondering what the difference between these 2 calls are..


    Code:
    Handler.BeginReceive(State.RBuff, 0, State.PacketSize, SocketFlags.None, New AsyncCallback(AddressOf ReceiveLock), State)
    And this one?

    Code:
    Handler.BeginReceive(State.RBuff, 0, State.PacketSize, SocketFlags.None, AddressOf ReceiveLock, State)
    They are both Asyncronous calls, I see some examples that use the "New AsyncCallback(AddressOf Method)" and some I just see "AddressOf Method", Is there any signifigant different? I tried both ways and they both seem to operate the same..

    Just wondering
    The only difference is the ReceiveLock variable is being declared in the method call in the first. In the second its already declared so they just pass it in.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Posts
    382

    Re: Re: What's the difference?

    Originally posted by DevGrp
    The only difference is the ReceiveLock variable is being declared in the method call in the first. In the second its already declared so they just pass it in.
    Hmm so let me get this straight then, The first one actually creates and uses it's OWN copy of the method ReceiveLock and runs it in its own space? The second one uses the "real" address of the method in the source? So the second one is like calling a Shared method then right?

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