01-24-2012
Stream sockets are streams. You don't know or care about things like what data goes in what packet. Neither does the receiving program. What actually happens, depends. The packets between the source and destination can be split up, recombined, merged, dropped, retransmitted, folded, spindled, and mutilated in a variety of interesting ways, not just before/during transmission, but after transmission, by hosts along the way. TCP does a lot of work for you, to make it simple for you to use.
If you don't want streams, don't use streams. You get what you want with UDP -- that sends individual packets, as you want, when you want them, without the benefit of arriving in the correct order or allowing the client to read them in whatever chunks they want. Of course they have a maximum size; that's what packet means.
Last edited by Corona688; 01-24-2012 at 05:22 PM..
10 More Discussions You Might Find Interesting
1. Programming
Hello there chaps.
First of all, i'm no TCP/IP-wiz, so forgive me if this is a stupid question.
I've been messing around with filetransfer using sockets, and there is one thing that confuses me.
This is how it's set up:
A server app listens on a port for a client connection.
When it... (3 Replies)
Discussion started by: crippe
3 Replies
2. Linux
Hi all,
A security scanner has been done on a linux server and have found that
The remote host does not discard RCP SYN packets which have the FIN flag set.
It tells that I need to request a patch which I haven't found yet.
I have Red Hat Linux release 7.0 (Guinness)
Kernel 2.2.16-22... (2 Replies)
Discussion started by: bert.n
2 Replies
3. UNIX for Dummies Questions & Answers
If I do a netstat -a I can see all the sockets currently open, is there a way that I can tell which application is holding open these sockets ? (3 Replies)
Discussion started by: murphyboy
3 Replies
4. AIX
I have what appears to be a unique socket problem, although admittedly my tcp/ip programming experience is relatively limited.
I have a AIX server process using TCP/IP berkely sockets, and a Windows (C#) process. The windows process takes input from a user and sends a message to the Unix... (1 Reply)
Discussion started by: adiaconou
1 Replies
5. Programming
Hello
I try to send DHCP RENEW packets to the network and receive the responses. I broadcast the packet and I can see that it's successfully sent using Wireshark. But I have difficulties receiving the responses.I use packet sockets to catch the packets. I can see that there are responses to my... (0 Replies)
Discussion started by: xyzt
0 Replies
6. Programming
Hello,
I'm trying to write a small c application to test a tcp port. This works fine for the most part but the default timeout on the connect is very long. I have been reading many posts but and it looks like I need to set the socket to be non-blocking and poll for a result. I have been totally... (2 Replies)
Discussion started by: tjones1105
2 Replies
7. Shell Programming and Scripting
Hello all,
I have a requirement to read and write to a tcp socket from an HP-UX shell script. I see a /dev/tcp character device on my servers:
crw-rw-rw- 1 root root 72 0x00004f Mar 28 18:37 /dev/tcp
So I believe this is what I should use. The problem is that all the... (2 Replies)
Discussion started by: lupin..the..3rd
2 Replies
8. IP Networking
I was analyzing a TCP snoop. And found following scenario
From Server to Client ---> SEQ 2993 ACK 1744 WIN 8192 LEN 13
From Server to Client ---> SEQ 3006 ACK 1744 WIN 8192 LEN 13
From Client to server --> SEQ 1744 ACK 3019 WIN 3304
I just want to know Why Packet 1 and 2... (3 Replies)
Discussion started by: mr_deb
3 Replies
9. AIX
Hi
The clients connect to my server -using port 9130. But no client could connect to my server at this time. I've checked already and this is the result
netstat -Aan|grep -v 127.0.0.1|grep 9130|pg
f10006000abcb398 tcp4 10313 0 10.0.89.81.9130 10.158.70.24.1705 CLOSE_WAIT... (8 Replies)
Discussion started by: bobochacha29
8 Replies
10. Shell Programming and Scripting
Hi and thank you in advance for taking the time to help. As I have less than 5 posts it said I had to remove the links you will need to help so good luck!
I am having issues building a packet and sending it to a Minecraft RCon server.
This is the Minecraft RCon Protocol information can be... (6 Replies)
Discussion started by: Stuperfied
6 Replies
udp(4p) udp(4p)
Name
udp - Internet User Datagram Protocol
Syntax
#include <sys/socket.h>
#include <netinet/in.h>
s = socket(AF_INET, SOCK_DGRAM, 0);
Description
UDP is a simple, unreliable datagram protocol that is used to support the SOCK_DGRAM abstraction for the Internet protocol family. UDP
sockets are connectionless and are normally used with the and calls, though the call can also be used to fix the destination for future
packets (in which case the or and or system calls may be used).
UDP address formats are identical to those used by TCP. In particular, UDP provides a port identifier in addition to the normal Internet
address format. Note that the UDP port space is separate from the TCP port space (for example, a UDP port may not be ``connected'' to a
TCP port). In addition broadcast packets can be sent (assuming the underlying network supports this) by using a reserved ``broadcast
address''; this address is network interface dependent. The SO_BROADCAST option must be set on the socket for broadcasting to succeed.
Diagnostics
A socket operation may fail with one of the following errors returned:
[EISCONN] Try to establish a connection on a socket which already has one, or when trying to send a datagram with the destination
address specified and the socket already connected.
[ENOTCONN] Try to send a datagram, but no destination address is specified, and the socket has not been connected.
[ENOBUFS] The system runs out of memory for an internal data structure.
[EADDRINUSE] An attempt is made to create a socket with a port that has already been allocated.
[EADDRNOTAVAIL]
An attempt is made to create a socket with a network address for which no network interface exists.
See Also
getsockopt(2), send(2), socket(2) recv(2), intro(4n), inet(4f)
udp(4p)