Ecere SDK/eC Forums http://ecere.com/forums/ Print view |
|
Networking Objects http://ecere.com/forums/viewtopic.php?f=8&t=53 |
Page 1 of 1 |
Author: | sacrebleu [ Tue Mar 16, 2010 5:18 pm ] |
Post subject: | Networking Objects |
How to use TCP/IP, Sockets, Servers and UDP? |
Author: | jerome [ Wed Mar 17, 2010 6:58 pm ] |
Post subject: | Re: Networking Objects |
There is a Ecere networking quickstart guide on the wiki. There are some networking samples in the sdk/samples/net folder. For UDP sockets, take a look at UDPSample. For TCP/IP, go up one directory and look at the threads/threadsAndListBoxes sample. It teaches you threads, listboxes and sockets all at once. It might be a bit much, but what a nice bundle Here is the relevant Socket code: Code: Select all
Code: Select all
Code: Select all
eCom - Implements a very simplistic (and useful) chat and file sharing system on a single connected socket eIRC - The beginnings of an IRC client smtp - Send mail! XMLSample - How to setup XML based protocol on a TCP/IP socket httpserver - a basic web server networkfile - implements a very specific protocol built in Ecere for file streaming complete with seeking and caching. DCOMSample - shows how to use the eC distributed object system, so that you don't actually need to write any networking code at all. You will also find Socket code in the games/Chess and games/Othello, and more distributed objects code in games/ruff and games/scrabble. |
Author: | fedor_bel [ Mon Apr 05, 2010 5:43 pm ] |
Post subject: | Re: Networking Objects |
Dear Jerome, I am trying to use the Socket and the Service class. They work great! But still I have got a question: how to make the service to stop listening without shutting down all already connected sockets. I have a listening service, once a connection is established, I create a socket, which is connected - all is great. then I want the service to stop listening, because I need only one socket connected, not more and I dont want an open port in a listening state. The already connected socket should remain connected, i will use it, I just want to shutdown the now unneeded listening socket. How to do it? Please, forgive me my stupidity, I tried to figure it out through the Samples, but did nof find such scenario there. btw, the processAlone flag is just sweet - I was so glad when I have discovered it and it did what i wanted Cheers, Fedor |
Author: | jerome [ Mon Apr 05, 2010 8:12 pm ] |
Post subject: | Re: Networking Objects |
Dear Fedor, The Service class does not have that functionality right now. It never came up as a use case until you asked for it just now I assume it is perfectly reasonable for you to want to close the listening socket without terminating the established connections... The API was originally written with the idea of a 'Service' that keeps running serving multiple clients, and thus as long as the service is running it keeps listening. If you no longer want to accept connections, then you simply don't create a Socket object in the Service's OnAccept anymore, so even though the socket is still listening, it will simply accept and terminate the connection right away (with a closesocket), which (in theory) shouldn't make it much of a security threat. The biggest problem left would be if you want to listen on that same port in another application or instance of that application... Now if you really want to close that socket, you will need to dive into the Ecere code First, I'd suggest to put a feature request on mantis. By the way since you seem to be making good use of Ecere, you're most welcome to join the project as a contributor I'm not sure if I've set you up with the CodeGuard repository yet? If not you can email or private message me about it I've attached two files with little tweaks to try to implement the functionality that you want... It adds a 'disconnectClientsOnStop' bool property (which defaults to 'true') to the Service class. There are still rough edges, for example starting the services again will add the Service a second time in the services link list. We should add another bool status flag in Service to tell whether the service is started or not, rather than just check 's' for non 0. Cheers, Jerome |
Author: | fedor_bel [ Wed Apr 07, 2010 10:07 am ] |
Post subject: | Re: Networking Objects |
Dear Jerome, Thank you for the files. I am wondering now how to use them? I have always been interested in doing some in-depth groung level programming, especially in such a nice project, as this!!! I have access to Mantis with Access Level reporter. |
Author: | jerome [ Wed Apr 07, 2010 11:20 am ] |
Post subject: | Re: Networking Objects |
Hi Fedor, You did build the SDK for the 0.44pre1 source tarball, right? These files go into ecere/src/net/ You can load up the ecere.epj project file in the IDE to build the Ecere runtime library. I recommend you install some files and folders comparison tool for a start A must for teamwork It would be best to get together on IRC sometimes, although that might be a bit difficult with your timezone... Cheers, Jerome |
Author: | fedor_bel [ Thu Apr 08, 2010 4:00 am ] |
Post subject: | Re: Networking Objects |
Hi, Jerome, Sure, the ecere project built very well and I happen to have some comparison tools. I dont have much time, because I am busy at my main job, but have much interest, it is a pleasure to take part in such a nice project. Maybe we could do the communication in some separate forum thread, that way we could keep the history and dont worry of time synchronisation that much. Cheers, Fedor |
All times are UTC-05:00 | Page 1 of 1 |
Powered by phpBB® Forum Software © phpBB Limited |