Thread: Sendto packets to a listening TCP socket

  1. #1
    Registered User Phoenix_Rebirth's Avatar
    Join Date
    Dec 2005

    Sendto packets to a listening TCP socket

    I have a few questions about TCP sockets:

    1) Can you use send and recvfrom with them? I cant see any reason why not though it is redundant since you use connect to form a path between sockets.

    2) If you set listen(socket, backlog) with a backlog of 0 or less (i.e -1) what happens? Does it mean that it rejects the packets that come?

    3) If I have a tcp socket listening how can I can make it so that every packets that comes is rejects and not stay in queue? I have a previous control statements with a udp socket and if it becomes true that it goes on to make a new thread wich accepts a connection at the tcp socket and begins communication but if that hasn't become true then I want the packets send to the tcp socket to drop so as to when an accept is called it won't form a connection with a client that had sent a packet previously but wasn't allowed a connection and the packet was there waiting.

    I can only think of accepting and right away closing the socket.
    Also after calling listen for a tcp socket it can only wait for a connect from a client and do an accept or can something else in the lines of send/recv be used?
    Last edited by Phoenix_Rebirth; 11-29-2009 at 11:19 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Listening socket and thread problem
    By esaptonor in forum Windows Programming
    Replies: 6
    Last Post: 06-19-2010, 03:04 AM
  2. Receive a TCP message on a UDP socket?
    By Yarin in forum C++ Programming
    Replies: 5
    Last Post: 09-05-2009, 12:21 AM
  3. Function call from another .c module
    By Ali.B in forum C Programming
    Replies: 14
    Last Post: 08-03-2009, 11:45 AM
  4. sendto Socket packet size
    By bj00 in forum Networking/Device Communication
    Replies: 0
    Last Post: 07-27-2007, 11:05 AM
  5. Accessing TCP flags in TCP packets on Linux using C !!
    By vishamr in forum Linux Programming
    Replies: 2
    Last Post: 10-16-2006, 08:48 AM