How to send a message to multiple users in a socket programming - Programmers Heaven

Howdy, Stranger!

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

Categories

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.