[twsocket] Socket server overhead
Hi, I have an application that continueous (every 500ms) have contact with a machine by rs232. Main thread. I want to send some information by socket when an external program ask this. So this program must also listen as a server socket. My question: when a server socket is in listening mode, does it take a lot of resources ?, would it be best to put this in a thread with low priority?, but if I do this, will the communication with the rs232 not take all the attention, so the thread with low priority will not work. Any response on this would be great. Thanks Werner -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Socket server overhead
Hello Werner, The component itself will take about 2 KB of memory. A listening socket (is a socket in rest) will take about 4 KB (nonpaged) memory. A data socket (if a client is connected) around 8 KB (nonpaged) because it is sending and receiving. As for other recources like CPU load etc, it is depending on amount of data and network speed, but since data is go/come from a serial device I should not worry about this. So I think a thread will be overkill. --- Rgds, Wilfried http://www.mestdagh.biz Saturday, October 8, 2005, 09:53, Werner wrote: Hi, I have an application that continueous (every 500ms) have contact with a machine by rs232. Main thread. I want to send some information by socket when an external program ask this. So this program must also listen as a server socket. My question: when a server socket is in listening mode, does it take a lot of resources ?, would it be best to put this in a thread with low priority?, but if I do this, will the communication with the rs232 not take all the attention, so the thread with low priority will not work. Any response on this would be great. Thanks Werner -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Socket one to one
Hello Werner, You always need a listening socket to accept inbound connections. When a client connect you accept/dup the client to a data socket. Server stay listening. You can use a normal TWSocket as server and handle the creation of data sockets, but then you are just re-inventing TWSocketServer who does that for you. You can set MaxClients to 2 if needed. Note that I'm talking about TCP. If you use UDP then you can do listen / send / receive with only 1 socket. But ICP is reliable the other not. --- Rgds, Wilfried http://www.mestdagh.biz Saturday, October 8, 2005, 10:02, Werner wrote: Hi, Is it possible to have a socket connection from client to client ? Because I need only a 1 to 1 connection, I don't need a server socket who is able to have multiple clients comming in. Is there a specific whay to have 1 to 1 connection. ? Has it any advantages not using serverSocket and only 2 clients-socket if this is possible Thanks Werner -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Socket one to one
- Original Message - From: Werner [EMAIL PROTECTED] To: twsocket@elists.org Sent: Saturday, October 08, 2005 9:02 AM Subject: [twsocket] Socket one to one Hi, Is it possible to have a socket connection from client to client ? Because I need only a 1 to 1 connection, I don't need a server socket who is able to have multiple clients comming in. Is there a specific whay to have 1 to 1 connection. ? Has it any advantages not using serverSocket and only 2 clients-socket if this is possible Thanks Werner -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be At the server end just use a TWSocket instead of a TWSocketServer if you only need one client. Then it needs to listen: Socket.Listen; and when a connection comes in (SessionAvailable) you accept it: Socket.HSocket := Socket.Accept; Then the connection is established. Dan -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be