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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to send a NULL through a Socket in Borland C++

How to send a NULL through a Socket in Borland C++

Scheduled Pinned Locked Moved C / C++ / MFC
c++delphihelptutorial
6 Posts 5 Posters 1 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.
  • K Offline
    K Offline
    Kavan Rathnayake
    wrote on last edited by
    #1

    I have a requirement of sending a string value to a specific ipAddress but the string value should enclose with two Ascii Null Values. Eg: NULL + message + NULL I managed to send the message using sck->Socket->SendText(Edit1->Text); but I don't know how to send a NULL value through the SocketClient component. I'm fairly new to C++. If any one can help me out it would be greatly appreciated. Thanks in advance.

    P _ D J 4 Replies Last reply
    0
    • K Kavan Rathnayake

      I have a requirement of sending a string value to a specific ipAddress but the string value should enclose with two Ascii Null Values. Eg: NULL + message + NULL I managed to send the message using sck->Socket->SendText(Edit1->Text); but I don't know how to send a NULL value through the SocketClient component. I'm fairly new to C++. If any one can help me out it would be greatly appreciated. Thanks in advance.

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      It's just character zero, does the SendText method allow that?

      You'll never get very far if all you do is follow instructions.

      K 1 Reply Last reply
      0
      • P PIEBALDconsult

        It's just character zero, does the SendText method allow that?

        You'll never get very far if all you do is follow instructions.

        K Offline
        K Offline
        Kavan Rathnayake
        wrote on last edited by
        #3

        PIEBALDconsult wrote:

        It's just character zero, does the SendText method allow that?
        You'll never get very far if all you do is follow instructions

        .

        Send Text Method does not allow that but the same program was developed by VB6 allows to send a VBNull value using WinSock component. It's not following instructions but the certain problem does need to send a NULL value because it the receiving end is just a circuit with a network port. Do you have any idea of sending a NULL value? It does not need to be the Send Text method.. Any method that allows to send a data packet with two NULL characters enclose with will do...

        1 Reply Last reply
        0
        • K Kavan Rathnayake

          I have a requirement of sending a string value to a specific ipAddress but the string value should enclose with two Ascii Null Values. Eg: NULL + message + NULL I managed to send the message using sck->Socket->SendText(Edit1->Text); but I don't know how to send a NULL value through the SocketClient component. I'm fairly new to C++. If any one can help me out it would be greatly appreciated. Thanks in advance.

          _ Offline
          _ Offline
          _Superman_
          wrote on last edited by
          #4

          The Socket object should be having another method to send raw bytes instead of text. Using that you should be able to send NULL. If not, you could try to send the \0 character - "\0MyText\0" whose length will be 8.

          «_Superman_»  _I love work. It gives me something to do between weekends.

          _Microsoft MVP (Visual C++) (October 2009 - September 2013)

          Polymorphism in C

          1 Reply Last reply
          0
          • K Kavan Rathnayake

            I have a requirement of sending a string value to a specific ipAddress but the string value should enclose with two Ascii Null Values. Eg: NULL + message + NULL I managed to send the message using sck->Socket->SendText(Edit1->Text); but I don't know how to send a NULL value through the SocketClient component. I'm fairly new to C++. If any one can help me out it would be greatly appreciated. Thanks in advance.

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            Send bytes, not strings.

            "One man's wage rise is another man's price increase." - Harold Wilson

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

            1 Reply Last reply
            0
            • K Kavan Rathnayake

              I have a requirement of sending a string value to a specific ipAddress but the string value should enclose with two Ascii Null Values. Eg: NULL + message + NULL I managed to send the message using sck->Socket->SendText(Edit1->Text); but I don't know how to send a NULL value through the SocketClient component. I'm fairly new to C++. If any one can help me out it would be greatly appreciated. Thanks in advance.

              J Offline
              J Offline
              jschell
              wrote on last edited by
              #6

              As noted in one of the replies on stackoverflow to your exact same question - you should read the documentation for the library and class that you are using.

              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