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?