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.

How to send a message to multiple users in a socket programming

molozamoloza Posts: 1Member
Hello All,,

I'm programing a small chat ptogram using socket programing in C.
I used fork() command to make my server code can handle multiple clients connections.

Now, I want if there any way or idea to make a message arrived from a client can be sent by the server to all online client.

What I do is to create an array which holds IP addresses of all online client, but I don't now if there such a command in Unix which can send buffer variable to specified IP address.

If so, or if some one have another ideas, I hope they help me..

with best CHEERS.

AJMI

Comments

  • dwccgcdwccgc Posts: 576Member
    : Hello All,,
    :
    : I'm programing a small chat ptogram using socket programing in C.
    : I used fork() command to make my server code can handle multiple clients connections.
    :
    : Now, I want if there any way or idea to make a message arrived from a client can be sent by the server to all online client.
    :
    : What I do is to create an array which holds IP addresses of all online client, but I don't now if there such a command in Unix which can send buffer variable to specified IP address.
    :
    : If so, or if some one have another ideas, I hope they help me..
    :
    : with best CHEERS.
    :
    : AJMI
    :

    You might find some help here.
    http://www.codeproject.com/internet/


  • IDKIDK Posts: 1,784Member
    : : Hello All,,
    : :
    : : I'm programing a small chat ptogram using socket programing in C.
    : : I used fork() command to make my server code can handle multiple clients connections.
    : :
    : : Now, I want if there any way or idea to make a message arrived from a client can be sent by the server to all online client.
    : :
    : : What I do is to create an array which holds IP addresses of all online client, but I don't now if there such a command in Unix which can send buffer variable to specified IP address.
    : :
    : : If so, or if some one have another ideas, I hope they help me..
    : :
    : : with best CHEERS.
    : :
    : : AJMI
    : :
    :
    : You might find some help here.
    : http://www.codeproject.com/internet/
    :
    :
    :
    This tutorial got a program that does exactly that: selectserver
    http://beej.us/guide/bgnet/output/html/index.html
Sign In or Register to comment.