?
Solved

Simple TServerSocket question

Posted on 2001-06-15
1
Medium Priority
?
163 Views
Last Modified: 2010-04-06
I'm wondering how I would go about sending text to all connected clients from a TServerSocket. Normally I use Socket.SendText to send to one I just recieved text from, but that only sends to a specific sock, I wanna send to ALL connected sockets... Any takers?
0
Comment
Question by:Psylord
1 Comment
 
LVL 5

Accepted Solution

by:
TheNeil earned 100 total points
ID: 6194394
Try iterating through all of your connections:

VAR
  iCount : LONGINT;
begin
  FOR iCount := 0 TO (ServerSocket1.Socket.ActiveConnections - 1)
  DO
    ServerSocket1.Socket.Connections[iCount].SendText(sMsg);
END;

The Neil =:)
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Integration Management Part 2
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month14 days, 10 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question