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 / C++ / MFC
  4. Sending messages with Server/Client

Sending messages with Server/Client

Scheduled Pinned Locked Moved C / C++ / MFC
sysadminquestion
3 Posts 2 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.
  • J Offline
    J Offline
    Jay Hova
    wrote on last edited by
    #1

    Hi All, I'm new to programming, so i have been trying to read and go to a few classes. I have been reading the tutorials on Server/Clients and am still a little confused. Right now i have a dialog that has a couple of check boxes on it, and I want to send the information of whether the boxes are checked or not to the server side . The message is just a string that looks like this : 2000 or 2001 I know that the two connect, but I can not get the message to be sent to the server. I am using the command: send (socket, buf,strlen(buf),0)where socket is instantiated in another dialog class that i use to connect to the server. How do I use the same socket that is already connected to the server to send this message. It won't compile unless i instantiate another socket in the dialog class with the check boxes. Many thanks in advance.

    V 1 Reply Last reply
    0
    • J Jay Hova

      Hi All, I'm new to programming, so i have been trying to read and go to a few classes. I have been reading the tutorials on Server/Clients and am still a little confused. Right now i have a dialog that has a couple of check boxes on it, and I want to send the information of whether the boxes are checked or not to the server side . The message is just a string that looks like this : 2000 or 2001 I know that the two connect, but I can not get the message to be sent to the server. I am using the command: send (socket, buf,strlen(buf),0)where socket is instantiated in another dialog class that i use to connect to the server. How do I use the same socket that is already connected to the server to send this message. It won't compile unless i instantiate another socket in the dialog class with the check boxes. Many thanks in advance.

      V Offline
      V Offline
      valikac
      wrote on last edited by
      #2

      Under winsock, the program calls Win32 API to access the socket. If you wanted to send data on one object and receive data in another object, then one solution is to pass the socket. Kuphryn

      J 1 Reply Last reply
      0
      • V valikac

        Under winsock, the program calls Win32 API to access the socket. If you wanted to send data on one object and receive data in another object, then one solution is to pass the socket. Kuphryn

        J Offline
        J Offline
        Jay Hova
        wrote on last edited by
        #3

        I'm sorry but i do not understand what to do. Once I have the client and the server connected, how do i send the message to the server? It doesn't seem to send the data to the server. Is there something I have to pass between the two cpp files, or can i just connect and then instantiate a SOCKET object and send it to that? Can someone possible give me some sample code...i looked at the tutorials on this site but i still can't get it to work. Thanks in advance.

        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