11-06-2008
C & TCP question: AF_INET vs AF_UNIX
Greetings!
I am attempting to write a *basic* network client in C. I have manage to create a socket but I have doubts as far as using AF_INET vs AF_UNIX.
At the present time, my client runs with AF_INET. Is AF_UNIX faster across hosts using the same OS flavor (Red Hat)? What is the difference between the two families?
I have found a post from 6 years ago asking the same question (
https://www.unix.com/security/8426-af...html#post29544 ) but it was never answered.
Any help is welcome. Thanks!
Al.
10 More Discussions You Might Find Interesting
1. Cybersecurity
I'm using AF_INET in sockets for inter process communication on the same machine. Is AF_UNIX better for IPC on the same machine than AF_INET in terms of performance? If so, how much better? I would like to know if there is sample code available to test this. I'm running the program on Solaris.
... (0 Replies)
Discussion started by: ivkumar
0 Replies
2. IP Networking
Here's a question I received on a test recently. I'm new to Linux/Unix so if this is easy, don't kill me. What scripting or tools could you use to count and sort the number of connections from each internal host? I'd appreciate any feedback and resources.
"The Cisco PIX firewall provides... (5 Replies)
Discussion started by: daveohr
5 Replies
3. IP Networking
as title. and how is it different from PF_INET ?
also, any one knows sin_family , sin_port , sin_addr ..etc ? why are they called 'sin' ?
finally, htons() host to network short , htonl() host to network long , ntohs() network to host short , ntohl() network to host long. why would... (6 Replies)
Discussion started by: trapeze
6 Replies
4. Programming
There is a server and a client,when client send a message to server,server can send a reply to client. The status of server and client is ESTABLISHED.Then I halt the client,I find the server status is CLOSE_WAIT and the client status is FIN_WAIT_2. Many minutes passed,I find the the server status... (1 Reply)
Discussion started by: konvalo
1 Replies
5. Shell Programming and Scripting
Hello everyone,
I am having to do a lot of perl scripting these days and I am learning a lot.
I have this problem
I want to move files from a folder and all its sub folders to one parent folder, they are all .gz files..
there is folder1\folder2\*.gz
and there are about 50 folders... (1 Reply)
Discussion started by: xytiz
1 Replies
6. Red Hat
Hi,
I want to kill TCP connections which have status as TIME_WAIT & no PID
(as per the output of the "netstat - p" command).
Is there any command/utility available to kill connections to a specific port or IP address.
The problem is that these connections don't have process ID (see... (4 Replies)
Discussion started by: Davinder31may
4 Replies
7. IP Networking
Hello all.
This is my first post and thank you for your forum.
Here is my question.
I have a simple setup at home and I was capturing some data with wireshark.
Data between a workstation and the web server, requesting a page.
Simple enough.
Now when I open wireshark, I apply the TCP... (4 Replies)
Discussion started by: squaresphere
4 Replies
8. Shell Programming and Scripting
Hi Guru's.
I am trying to use to check if $5 is greater than 80 & if not 100, then to print $0 :
awk '{ if ($5>80) && if ($5 != 100) print $0}
But getting error:
>bdf1|sed 's/%//g'|awk '{ if ($5>80) && if ($5 != 100) print $0}'
syntax error The source line is 1.
The error... (6 Replies)
Discussion started by: rveri
6 Replies
9. Solaris
I have problem with oracle solaris 10 running on oracle sparc T4-2 server.
Os information: 5.10 Generic_150400-03 sun4v sparc sun4v
Output from tcpstat.d script
TCP bytes: out outRetrans in inDup inUnorder
6833763 7300 98884 0... (2 Replies)
Discussion started by: insatiable1610
2 Replies
10. Programming
Hi guys , i write this message for a doubt, a time ago i wrote a client/server program with TCP/IP in Linux. When i tested the program flooding the server with messages of 1024 bytes (Or 1025 bytes i dont remember exactly the number but was more that 1000 bytes) in certain point a message was... (5 Replies)
Discussion started by: Kovalevski
5 Replies
udp(7) Miscellaneous Information Manual udp(7)
NAME
udp - Internet user datagram protocol (UDP)
SYNOPSIS
#include <sys/socket.h> #include <netinet/in.h>
The following is the socket call for AF_INET sockets:
s = socket(AF_INET, SOCK_DGRAM, 0); The following is the socket call for AF_INET6 sockets:
s = socket(AF_INET6, 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 sendto() and recvfrom() functions, though the connect() function may also be
used to fix the destination for future packets, in which case the recv() or read() and send() or write() functions 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 (that is, a UDP port may not be "connected" to a TCP
port). In addition, IPv4 broadcast packets may be sent (assuming the underlying network supports this) by using a reserved "broadcast
address"; this address is network interface dependent. There is no broadcast address in IPv6.
Options at the IP transport level may be used with UDP; see the ip() reference page.
ERRORS
If a socket operation fails, errno may be set to one of the following values: An attempt was made to create a socket with a port that has
already been allocated. An attempt was made to create a socket with a network address for which no network interface exists. The socket
is already connected. This error occurs when trying to establish connection on a socket or when trying to send a datagram with the desti-
nation address specified. The system ran out of memory for an internal data structure. The destination address of a datagram was not
specified, and the socket has not been connected.
RELATED INFORMATION
Functions: getsockopt(2), recv(2), send(2), socket(2)
Files: netintro(7), inet(7), ip(7) delim off
udp(7)