Jump to content

Need some help with a client server app


Recommended Posts

Hello . I was making this client server app based on TCP. It worked fine until i started introducing new features to it. When introducing the new features i thought using multiple tabs in the same gui would be a great idea. Now , there are two particular tabs having different functions assigned to them. What i did there was to check for user inputs and send them to the server which inturn would send them to the other clients. The question is how do i make the server detect from which control the message is coming and to which control to display the message in the client. For eg if my tab 1 is a chat engine , tab 2 is, say, another chat engine...then how do i write the code so that the server is able to detect if the message came from tab 1 or tab 2 and to display the message correspondingly to the other client interfaces. As of now , with what i did , the content of each tab is overlapping which is quite obvious. I just need some ideas on how this can be done. Thanks in advance . hope i am clear with what i mean. :unsure:

Link to comment
Share on other sites

Hi DarkAngel,

you need to alter the data you send via TCP. E.g. Prepend a TAB index or similar. I don't think it is possible to find out via a simple TCP package/stream from what control it has been sent unless you really attach the data about it.

:unsure:

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

Thanks hannes ! " prepend a tab index " - can u explain a little bout that ? :unsure:

Cant two separate sockets be created to handle the different streams? Like port 1 for the stuff of 1 tab . and port 2 for the other ? is creating multiple sockets in a single script possible ?

Link to comment
Share on other sites

Hi DarkAngel,

I'm not sure if this is state-of-the-art programming, but you could for example insert a "1|", "2|" ... "n|" before your message/data, and on the other side (server) you can check on the text at the beginning of the message. (Everything with 1| at the beginning belongs to tab 1...)

I'm pretty sure It's possible that you can open multiple sockets per script, but right now I don't know how. :unsure:

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...