Developing chat application

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

    Developing chat application

    Hello,

    I've assigned to develop a simple chat application using "C" program.
    I've written program but missing one thing. Simultaneously both user
    can type in their window. But i dont know how to implement this, in
    such way that at all the time, same thread/process should be able to
    send and recieve message from/to between their desination.

    I've written code, in that once the user1 typed the message, it cant
    send an another message untill it gets a message from the user2. Becoz
    i 've coded as receive and send in user2, and in user1 send and
    receive. I believe i've explained my problem.

    I think i'm missing some where, can any one point how to achieve this.

    Best regards,
    Sangeetha.
  • Malcolm

    #2
    Re: Developing chat application


    "sangeetha" <sangeetha_b@in dia.com> wrote[color=blue]
    >
    > I've assigned to develop a simple chat application using "C" program.
    > I've written program but missing one thing. Simultaneously both user
    > can type in their window. But i dont know how to implement this, in
    > such way that at all the time, same thread/process should be able to
    > send and recieve message from/to between their desination.
    >
    > I've written code, in that once the user1 typed the message, it cant
    > send an another message untill it gets a message from the user2. Becoz
    > i 've coded as receive and send in user2, and in user1 send and
    > receive. I believe i've explained my problem.
    >[/color]
    If you're writing for a desktop system, you will probably need two
    "clients", terminals with VDU and keyboard.
    C doesn't specify how to do this. ANSI C programs just have stdin and
    stdout, which are inherently single streams and support only one user. You
    need to look at the libraries on your system, which is probably either X or
    MS Windows.


    Comment

    • Kieran Simkin

      #3
      Re: Developing chat application

      "sangeetha" <sangeetha_b@in dia.com> wrote in message
      news:4fde56d3.0 409182038.64f16 6b3@posting.goo gle.com...[color=blue]
      > Hello,
      >
      > I've assigned to develop a simple chat application using "C" program.
      > I've written program but missing one thing. Simultaneously both user
      > can type in their window. But i dont know how to implement this, in
      > such way that at all the time, same thread/process should be able to
      > send and recieve message from/to between their desination.
      >
      > I've written code, in that once the user1 typed the message, it cant
      > send an another message untill it gets a message from the user2. Becoz
      > i 've coded as receive and send in user2, and in user1 send and
      > receive. I believe i've explained my problem.[/color]

      I believe you haven't explained it very well. However, could this be an
      issue with blocking sockets? Ie, you're waiting for a message from the other
      end of your connection and program is blocking on the receive call? Anyway,
      sockets are off-topic here, so you will not get the best advice, best go
      find a newsgroup dedicated to your specific platform. However, if the
      problem is as I've described, either look into non-blocking sockets, or
      consider a multi-process setup.

      [color=blue]
      >
      > I think i'm missing some where, can any one point how to achieve this.
      >
      > Best regards,
      > Sangeetha.[/color]


      Comment

      Working...