socket

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • green
    New Member
    • Oct 2007
    • 7

    #1

    socket

    I have an application that send requests to a server and then server respond.

    request ... response
    request ... response
    ... ...


    so how can I manage this application?
    can I used the socketChannel or socket ??????????????? ???

    blocking sockets or non-blocking sockets ??????????????? ?


    please reply
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by green
    I have an application that send requests to a server and then server respond.

    request ... response
    request ... response
    ... ...


    so how can I manage this application?
    can I used the socketChannel or socket ??????????????? ???

    blocking sockets or non-blocking sockets ??????????????? ?


    please reply
    What do you mean by "manage this application"? Does it misbehave or doesn't it work?

    kind regards,

    Jos

    Comment

    • green
      New Member
      • Oct 2007
      • 7

      #3
      Originally posted by JosAH
      What do you mean by "manage this application"? Does it misbehave or doesn't it work?

      kind regards,

      Jos

      dear Jos,
      thanks for reply..
      I'm in a big problem , that I can't solve it
      my IT director ask me to build an application to get data from a server.
      so I make a socket connection with this server.
      I send first the authentication to the server, so server send ALLOW message.
      then I start to send request and it response with a response message.
      the PROBLEM is that I can't get all the response message.
      I make Thread.sleep(40 00) between sending the request and the response...
      but no way
      I make Thread.sleep(60 00) or even Thread.sleep(10 000) but no way
      its usually not all the data
      so how can I read all the data from the socket response

      waiting ur help

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by green
        dear Jos,
        thanks for reply..
        I'm in a big problem , that I can't solve it
        my IT director ask me to build an application to get data from a server.
        so I make a socket connection with this server.
        I send first the authentication to the server, so server send ALLOW message.
        then I start to send request and it response with a response message.
        the PROBLEM is that I can't get all the response message.
        I make Thread.sleep(40 00) between sending the request and the response...
        but no way
        I make Thread.sleep(60 00) or even Thread.sleep(10 000) but no way
        its usually not all the data
        so how can I read all the data from the socket response

        waiting ur help
        Does that server use some sort of protocol? It can't just send a bunch of bytes
        where the client has to automagically 'guess' how many bytes it is supposed to
        receive.

        kind regards,

        Jos

        Comment

        • green
          New Member
          • Oct 2007
          • 7

          #5
          Originally posted by JosAH
          Does that server use some sort of protocol? It can't just send a bunch of bytes
          where the client has to automagically 'guess' how many bytes it is supposed to
          receive.

          kind regards,

          Jos
          The answer for your question is (yes)., server sends a bunch of bytes

          is socketchannel solve this problem ??
          socketchannel is non-blocking..

          waiting




          can I write to u directly ?? to ur eamil

          Comment

          • JosAH
            Recognized Expert MVP
            • Mar 2007
            • 11453

            #6
            Originally posted by green
            The answer for your question is (yes)., server sends a bunch of bytes

            is socketchannel solve this problem ??
            socketchannel is non-blocking..

            waiting




            can I write to u directly ?? to ur eamil
            If your server side is so rigid (and stupid) SocketChannels don't buy you much
            either. All you can do assume that everything has been read after a little time
            span had passed and nothing was read. You an use separate Threads for that,
            or if you want you can use SocketChannels.

            Please don't email me; this problem might be interesting to others as well.

            kind regards,

            Jos

            Comment

            Working...