# C/c++ socket server help?

**URL:** https://forum.kirupa.com/t/c-c-socket-server-help/295291
**Category:** Uncategorized
**Created:** [August 27, 2009, 6:35pm UTC](https://forum.kirupa.com/t/c-c-socket-server-help/295291 "2009-08-27T18:35:11Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![joran420](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joran420/32/2329_2.png) [@joran420](https://forum.kirupa.com/u/joran420)
#### Post date: [August 27, 2009, 6:35pm UTC](https://forum.kirupa.com/t/c-c-socket-server-help/295291/1 "2009-08-27T18:35:11Z")

</div>

Hey dunno if anyone will have any insight…but  
Im in the proccess of creating a c++ socket server(actually it works)

im using the following code to send messages to the client

```auto

 n = read(newsockfd,buffer,255);
     if (n < 0) error("ERROR reading from socket");
     printf("Here is the message: %s
",buffer);
     sprintf(buffer,"Welcome User %d ",clientID++);
     write(newsockfd,buffer,strlen(buffer));
     write(newsockfd,"
\0",3);

```

and it sends the code to one specific client (newsockfd)  
but i want to broadcast messages to all connected clients…  
can anyone tell me how to do this?
