Socket Example Wanted

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

    #1

    Socket Example Wanted


    Does anyone know of a good asynchronous socket exsample. There are some
    exsamples in the documentation and around on the net. But they are all in
    the same way: The server reseived a connection from the client, read
    something and send something back.

    A need an exsamlple were a client connect´s to a server, and then the
    connection is kept up. The client can then send data to the server when ever
    it whant to. But the Server can also send data to the client when ever it
    want to.

    The Connection can then be disconnected by the Client.

    I hope someone can understand me, and se how this exsample differs from the
    examples out there.

    If someone can desripe how to make such a solution they are also welcome.
    Dont you need to make a Thread on the server representing each client ?

    Best Regards

    Anders Both , Denmark.


  • Bret Mulvey [MS]

    #2
    Re: Socket Example Wanted


    "Anders Both" <andersboth@hot mail.com> wrote in message
    news:ehJ9#RyqDH A.2772@TK2MSFTN GP12.phx.gbl...[color=blue]
    >
    > Does anyone know of a good asynchronous socket exsample. There are some
    > exsamples in the documentation and around on the net. But they are all in
    > the same way: The server reseived a connection from the client, read
    > something and send something back.
    >
    > A need an exsamlple were a client connect´s to a server, and then the
    > connection is kept up. The client can then send data to the server when[/color]
    ever[color=blue]
    > it whant to. But the Server can also send data to the client when ever it
    > want to.
    >[/color]

    Have you seen the example at
    http://msdn.microsoft.com/library/en...blockingserver
    socketexample.a sp? It does disconnect from the client eventually (of
    course) but not until the client signals that it is done with the
    conversation by sending "<EOF>". Until that happens, it should maintain the
    connection and you should be able to process multiple requests from the
    client. You can pull out the disconnect code from the Send() method and put
    it into it's own method so that you can make multiple responses back to the
    client over the duration of the connection.



    Comment

    • Anders Both

      #3
      Re: Socket Example Wanted

      Thx, I saw that exsample but still I would like some more exsample. But
      anyway in the meantime I am begining to understand everything.

      Best Regards



      "Bret Mulvey [MS]" <bretm@online.m icrosoft.com> wrote in message
      news:#lW#pWzqDH A.2588@tk2msftn gp13.phx.gbl...[color=blue]
      >
      > "Anders Both" <andersboth@hot mail.com> wrote in message
      > news:ehJ9#RyqDH A.2772@TK2MSFTN GP12.phx.gbl...[color=green]
      > >
      > > Does anyone know of a good asynchronous socket exsample. There are some
      > > exsamples in the documentation and around on the net. But they are all[/color][/color]
      in[color=blue][color=green]
      > > the same way: The server reseived a connection from the client, read
      > > something and send something back.
      > >
      > > A need an exsamlple were a client connect´s to a server, and then the
      > > connection is kept up. The client can then send data to the server when[/color]
      > ever[color=green]
      > > it whant to. But the Server can also send data to the client when ever[/color][/color]
      it[color=blue][color=green]
      > > want to.
      > >[/color]
      >
      > Have you seen the example at
      >[/color]
      http://msdn.microsoft.com/library/en...blockingserver[color=blue]
      > socketexample.a sp? It does disconnect from the client eventually (of
      > course) but not until the client signals that it is done with the
      > conversation by sending "<EOF>". Until that happens, it should maintain[/color]
      the[color=blue]
      > connection and you should be able to process multiple requests from the
      > client. You can pull out the disconnect code from the Send() method and[/color]
      put[color=blue]
      > it into it's own method so that you can make multiple responses back to[/color]
      the[color=blue]
      > client over the duration of the connection.
      >
      >
      >[/color]


      Comment

      Working...