Murhaf Sousli
Murhaf Sousli

Reputation: 13296

how would i have more than one separate NetworkStream on the same port?

im making a Server-Client application..

  • chat
  • sends commands
  • file-transfer

    i was wondering if it is possible to use only one port for all of them rather than (bind,listen,accept) for each port of them .. because in my application .. i want to connect once only .. and it seems ridiculous to connect 3 times .. how do i have a more than on separate NetworkStream if i want to connect (chat,commands,file-transfer) on the same port .. and if it's not possible.. what's the best structure to do that
    im using tcp protocol for all of them.. hope i cleared my question .. thanks in advance :)

    Upvotes: 0

    Views: 154

  • Answers (1)

    horsley
    horsley

    Reputation: 480

    It's possible, you don't need to have seperate NetworkDtream but you need to distinguish different resource type, which means, you just send that 3 types of resources in ONE NetworkStream and you can define some flags to distinguish them and them make different proceed.

    Even though, I think you should have a extra port to transfer files , commands and chats were short while files data was quite big

    Upvotes: 1

    Related Questions