sending in socket

This is a discussion on sending in socket within the C Programming forums, part of the General Programming Boards category; hi.. is it possible to send values in a socket one at a time.. like sending one then close 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,211
    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,765
    > 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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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, 10: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, 06:49 AM
  3. sending zero bytes over TCP socket
    By nantonop in forum Networking/Device Communication
    Replies: 4
    Last Post: 09-03-2007, 09: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, 11:11 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21