winsock2 - most efficient way to send function calls to clients from server using Winsock 7 C++ -
i have used c++ & winsock create both server , client applications. after connecting server, client displays animation sequence. server machine can handle multiple client connections , keeps count of total number of clients connected.
currently, client animation sequence begins client connects. want happen, when 2 clients have connected server, server should send message client 1 call render() function (which in client) then, @ later time, send message client 2 calls same render() function.
just looking best way achieve this.
thanks
you can't send function calls (in direct meaning of word), since functions live within single process space , can't (easily) sent across socket connection.
what can send message client act on , call desired function.
depending on protocols using, simple server sending single byte (e.g. 'r' render, or something) each client's tcp connection, , client code know call render() when receives byte. more complex protocols might encode same information more elaborately, of course.
in interpreted languages (e.g. java or python) possible send actual code across socket connect, in form of java .class files or python source text, or etc. it's bad idea so, attacker exploit mechanism send malware client , have client execute it.
Comments
Post a Comment