Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

chat program using linux networking

Hi everyone,
I have just started network programming on linux and i wrote some very basic client-server programs. My university has a lan and i thought it would be fun to write a chat program for the lan, but i dont know how to proceed, can anyone help me out?

Thanks

Comments

  • gustavo-serragustavo-serra Posts: 21Member
    Maybe you could fork your main process into two:

    The father will read user input and send it through the socket.
    The son will receive data and display it on the screen.

    If I am right, you can't use the same socket for both son and father, as the file descriptor (the socket) is not shared among them. Each process (father and son) will open its own connection. You could also use a thread, which I think that would make your job a lot easier.

    Anyway, it is an idea.
    Good luck!
  • gustavo-serragustavo-serra Posts: 21Member
    Maybe you could fork your main process into two:

    The father will read user input and send it through the socket.
    The son will receive data and display it on the screen.

    If I am right, you can't use the same socket for both son and father, as the file descriptor (the socket) is not shared among them. Each process (father and son) will open its own connection. You could also use a thread, which I think that would make your job a lot easier.

    Anyway, it is an idea.
    Good luck!
  • gustavo-serragustavo-serra Posts: 21Member
    Maybe you could fork your main process into two:

    The father will read user input and send it through the socket.
    The son will receive data and display it on the screen.

    If I am right, you can't use the same socket for both son and father, as the file descriptor (the socket) is not shared among them. Each process (father and son) will open its own connection. You could also use a thread, which I think that would make your job a lot easier.

    Anyway, it is an idea.
    Good luck!
  • sohbetisohbeti Posts: 58Member
    This post has been deleted.
Sign In or Register to comment.