Dear friends : I am develloping an app that will send images to connected clients in jpg form. I am using winsock to do it, and till present moment,I can accept a client connection and send to him a test http page. My question is : The client will connect to server, receive a page asking for username and password; After the client authenticated successfully, the server will send a main page and a java applet that will be responsible of make the control of the images by demand (it will send an image request, wait till the image arrives,display it and so forth...). OK, at this time, my question is : How, using winsock and threads, can I make it ? I have to create a new thread for every client that connects to server, OK? But, how can I detect for each of them the FD_READ message, asking for new image??? Thank to everybody in advance : Sergio A.S. de Aguiar
Posted on 2001-01-26 21:51:00 by ssaguiar
I'm coding a similar image server.I design my server like this: - create a listening socket - when a client connects to that socket, create a new thread - the first thing the new thread does is create a new window - after the window is created, accept the connection - call WSAAsyncSelect on the newly created socket, directing winsock to send notifications pertaining the new socket to the window just created As you can see, each thread has its own window so there is one-to-one relationship between a socket-a client and a window. Each thread/socket handles a specific client.
Posted on 2001-01-27 05:23:00 by Iczelion
here's just another idea: I'm working on a multiple-connection file transfer based on a http web server. On an incomming connection, a new thread is created and given it's own allocated memory space. This memory contains threadspecific handles, data etc. I designed a simple message queue for each thread, the thread mem contains a small message queue where messages can be posted. FD_READ, FD_WRITE messages etc. are routed by the main program to the correct thread in the form of a thread message. It is a little complicated method but it works very good for me and there's no need of creating a window for each thread. Thomas
Posted on 2001-01-27 12:36:00 by Thomas
The idea of having a window is a good solution, but, if there's a lot of clients connected I suppose those windows are invisible, right? If you want, I can send you my source code. It's not yet ready, nor it's sending any images yet, but will do it soon. How are you converting to JPG? I am using the smaller animal's dll. In the Thoma's case, it seems to be a good way to work without a window for every client, but it's a little complicated for me. where could I see some source code about this approach? ssaguiar
Posted on 2001-01-27 14:11:00 by ssaguiar