Socket in NET

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jianxin

    #1

    Socket in NET

    Hi,

    As I understand, one of the windows socket features is to
    be able to connect to window message. As implemented in
    CAsyncSocket class of MFC for example, OnReceive(),
    OnAccept() etc. give you a handy way to deal with socket
    events without using multithread.

    I have just scaned through the Socket class in NET. But I
    cannot see anything or anyway to do simillar things such
    as OnReceive() OnAccept() in MFC.

    Is there any way in which I can simillar thing in NET?

    Thanks in advance.

    Jainxin
  • Jianxin

    #2
    Re: Socket in NET

    Hi, Nicholas,

    Thanks for your quick response. I think your suggestion
    will do the job I have in mind.

    After reading the NET doc, it seems to me that the
    callback function provided in BeginXXX function will be
    executed in a different thread from main window thread.
    Is that right?

    Jianxin

    [color=blue]
    >-----Original Message-----
    >Jianxin,
    >
    > In .NET, you will want to use the BeginRecieve and[/color]
    EndReceive methods on[color=blue]
    >the Socket class to be notified when a socket gets data[/color]
    coming in.[color=blue]
    >Basically, the call to BeginReceive will cause the work[/color]
    to be done on[color=blue]
    >another thread and will notify your callback when the[/color]
    operation is complete.[color=blue]
    >
    > Consequently, you can use the BeginAccept and[/color]
    EndAccept methods as well[color=blue]
    >to wait for an incoming connection.
    >
    > Hope this helps.
    >
    >--
    > - Nicholas Paldino [.NET/C# MVP]
    > - nicholas.paldin o@exisconsultin g.com
    >
    >"Jianxin" <jhou@sgs-jnt.com> wrote in message
    >news:02a801c35 08d$d1082a90$a5 01280a@phx.gbl. ..[color=green]
    >> Hi,
    >>
    >> As I understand, one of the windows socket features is[/color][/color]
    to[color=blue][color=green]
    >> be able to connect to window message. As implemented in
    >> CAsyncSocket class of MFC for example, OnReceive(),
    >> OnAccept() etc. give you a handy way to deal with[/color][/color]
    socket[color=blue][color=green]
    >> events without using multithread.
    >>
    >> I have just scaned through the Socket class in NET.[/color][/color]
    But I[color=blue][color=green]
    >> cannot see anything or anyway to do simillar things[/color][/color]
    such[color=blue][color=green]
    >> as OnReceive() OnAccept() in MFC.
    >>
    >> Is there any way in which I can simillar thing in NET?
    >>
    >> Thanks in advance.
    >>
    >> Jainxin[/color]
    >
    >
    >.
    >[/color]

    Comment

    Working...