Thread: sending in socket

  1. #1
    Registered User
    Join Date
    Sep 2007
    Location
    somewhere out there
    Posts
    7

    sending in socket

    hi.. is it possible to send values in a socket one at a time..
    like sending one then close socket connection then open it again and send another one but different..
    thanks...

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    The other side might get really upset with you opening and closing new connections, plus that is kind of stupid.

  3. #3
    Registered User
    Join Date
    Sep 2007
    Location
    somewhere out there
    Posts
    7
    Quote Originally Posted by MacGyver View Post
    The other side might get really upset with you opening and closing new connections, plus that is kind of stupid.
    didnt think of that...
    ah.. is there a way that a server sends its service status through a socket...
    for example httpd status send to socket blah blah...
    or should i send all the services in a big chunk of data?
    or send them one at a time?
    thanks for the reply..

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > or should i send all the services in a big chunk of data?
    > or send them one at a time?
    So long as the receiver can tell when one ends and the next starts, send them all in quick succession.

    TCP is just a stream of bytes, it's up to the sender/receiver to agree a protocol.

    HTTP for example uses printable characters separated by newlines.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Sep 2007
    Location
    somewhere out there
    Posts
    7
    what i just did was i send them in a big chunk of data... when i got it from my client side..
    it was written in like.. httpd#up#smtp#down#xinetd#up and so on..
    i seperated them by a delimiter "#"
    i saw a site that specify if that service is down by socket..
    it says "connection timeout to socket".. i dont know how to that?
    is there a tutorial leading to that way? thanks for the replies..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Casting a struct for sending to socket
    By chrisjmoss in forum Networking/Device Communication
    Replies: 6
    Last Post: 04-08-2008, 09:11 AM
  2. Problem while constructing IP packet and sending using socket() system call
    By cavestine in forum Networking/Device Communication
    Replies: 10
    Last Post: 10-15-2007, 05:49 AM
  3. sending zero bytes over TCP socket
    By nantonop in forum Networking/Device Communication
    Replies: 4
    Last Post: 09-03-2007, 08:10 AM
  4. socket message sending and receiving problem
    By black in forum C Programming
    Replies: 5
    Last Post: 01-15-2007, 04:46 AM
  5. sending HTTP POST data with Socket
    By Overtaker in forum Networking/Device Communication
    Replies: 10
    Last Post: 09-07-2006, 10:11 AM