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. Socket question

Socket question

Scheduled Pinned Locked Moved C#
sysadminquestionlounge
1 Posts 1 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.
  • R Offline
    R Offline
    RoyRose78
    wrote on last edited by
    #1

    Hey all, I'm new to web app dev so I'll ask a simple question.. I created a simple chat application with client & server sockets. after initialation & establishing the connection, I send text message to the server. when I send the first message, the server gets it and displays it, now, I realized that after the client sends the first message to the server, I need to reconnect to it again in order to send another message(s).. The question is Do I need to reconnect to the server everytime, even though I have the server & client socket objects initialized... my client code is like this: private void btnSend_Click(object sender, System.EventArgs e) { btnConnect_Click(sender, e);//without this proc. I can send only 1 msg try{ string msg = TxtSnd.Text+""; byte[] byteData = Encoding.ASCII.GetBytes(msg); lblstts.Text = "Sendeing...";//status label clientMe.Send(byteData); TxtSnd.Text = "";//delete text from TextBox }catch(Exception Ex) { MessageBox.Show(Ex.Message); } }

    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