delphi - Receiving strings and images on the same socket with ICS v8 -


i working on small client/server project, , decided try switch on using ics. unfortunately, have no experience ics, , little experience sockets in general. server needs able receive strings clients, , process them. server needs able receive images clients.

because noob, using 2 sockets accomplish this: tserversocket strings, , indy tcp server component images. switching ics, prefer consolidate 2 functions single socket, because don't think it's normal server require different socket each different type of transmission needs process.

i experiencing 2 major hurdles:

  • i don't know best way attack problem of receiving multiple types of data same event handler. imagine have ondataavailable handler default reading strings, , make client send server string indicates it's going send image next (in case server switch reading image). there more efficient way go it, though? want server able handle many clients @ once, , want fast , stable possible, there "preferred" method of handling type of situation?
  • i don't know how send/receive image using ics. indy, making client save images tmemorystream , using 'sendstream' , 'receivestream' functions, ics doesn't have functions handle streams (as far can tell). suppose need use 'send' , 'receive', don't know sure best way go that. can use reference tjpegimage object buffer, or need save stream, , read stream array of bytes before can send it? also, understand sending/receiving files bit trickier on non-blocking sockets, best way approach that?

if offer suggestions, or sample code, appreciate help.

i apologize length of question, , apologize if seems i'm asking hand me solution. i've not quite managed find ics demo answers of questions, , google doesn't seem friend on one. i'm reluctant start hacking away @ without getting feedback people know more do, because want implement efficient of solution can. in advance.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -