Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. quick tcp question

quick tcp question

Scheduled Pinned Locked Moved C#
question
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pokabot
    wrote on last edited by
    #1

    How do you go about creating your own packet to send over TCP?

    L 1 Reply Last reply
    0
    • P pokabot

      How do you go about creating your own packet to send over TCP?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Server : http://msdn2.microsoft.com/en-us/library/system.net.sockets.tcplistener.aspx[^] Client : http://msdn2.microsoft.com/en-us/library/system.net.sockets.tcpclient(VS.80).aspx[^]

      P 1 Reply Last reply
      0
      • L Lost User

        Server : http://msdn2.microsoft.com/en-us/library/system.net.sockets.tcplistener.aspx[^] Client : http://msdn2.microsoft.com/en-us/library/system.net.sockets.tcpclient(VS.80).aspx[^]

        P Offline
        P Offline
        pokabot
        wrote on last edited by
        #3

        What I meant to ask was how would you go about creating your own protocol so the client knew what type of message it was recieving (could be text or other type of data). Also would it be ok to create 2 seperate sockets, one for sending and one for recieving? Thankyou

        E 1 Reply Last reply
        0
        • P pokabot

          What I meant to ask was how would you go about creating your own protocol so the client knew what type of message it was recieving (could be text or other type of data). Also would it be ok to create 2 seperate sockets, one for sending and one for recieving? Thankyou

          E Offline
          E Offline
          engsrini
          wrote on last edited by
          #4

          u can follow the generic format ie. ____________________________ command |length |data |CRC | ------------------------------------- if you are sending as string separate each with a spl char. like "$". or if it is byte array, convert the formated string to byte array using this ASCIIEncoding.GetBytes(stringpkt) qn#2 it is ok to send it as 2 packets, as long as you have identity for packets & also the client must understand ur protocol format. eg. you can maintain one field on the packet to identify "Packet is over or not", if not over, client will listen for rest of the packets regards, Srini

          modified on Wednesday, February 13, 2008 10:12 PM

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups