12-05-2008
I was searching proftpd code, but the answer is hidden as much as possible. So I tried to solve it myself, and here is my solution:
char *ip=malloc(20*sizeof(char));
struct sockaddr_in myAddr;
int sin_size = sizeof(myAddr);
getsockname(clientSocket, (struct sockaddr *)&myAddr, (socklen_t *)&sin_size);
strncpy(ip,inet_ntoa(myAddr.sin_addr),strlen(inet_ntoa(myAddr.sin_addr)));
7 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Folks!! I had a very huge file containing 4GB of data in it and i had to move that to a different server. Since, i thought moving of 4GB data is gonna take more time, i splitted the file into four parts using split command
split -b 1499889664 abcd.cpk
It splitted the file and now after... (3 Replies)
Discussion started by: ganga.dharan
3 Replies
2. IP Networking
HI All,
This is about the Basics of INADDR_ANY. When we bind to the server by placing the value of sin_addr.s_addr as INADDR_ANY, Does it binds to all the IP addresses( If that system is multi homed one)
with the specified port?.
i.e if the system is having IP1 , IP2 and IP3 addresses and... (3 Replies)
Discussion started by: athresh
3 Replies
3. IP Networking
Hello !
I seem to have the same problem as in https://www.unix.com/ip-networking/91203-inaddr_any-opposite.html#post302262417
But I can't find a solution.
I have a UDP server socket bound to 0.0.0.0. The server hosts the addresses IP1, IP2 and IP3. I get an incoming request to IP1. I use... (1 Reply)
Discussion started by: steinwej
1 Replies
4. Programming
Hi there, if i run
SELECT now() -interval 1 day
I get all items within the last 24 hours. How would I reverse/adjust this so that i get everything that ISNT in the last 24 hours ?
any help on this would be greatly appreciated
Cheers (1 Reply)
Discussion started by: rethink
1 Replies
5. UNIX for Dummies Questions & Answers
there is something wrong with my system. when I do this:
diff file1 file1 && echo 1
the output is 1.
but
diff file1 file2 >/dev/null && echo 1
output nothing
while
diff file1 file2 >/dev/null || echo 1
shows 1.
the same with "grep" return status. they are both GNU utilities.... (5 Replies)
Discussion started by: phil518
5 Replies
6. UNIX for Beginners Questions & Answers
I have a dateset like this:
Gly1 Gly2 2 1 0
Gly3 Gly4 3 4 5
Gly3 Gly5 1 3 2
Gly2 Gly1 3 6 2
Gly4 Gly3 2 2 1
Gly6 Gly4 4 2 1what I expected is:
Gly1 Gly2 2 1 0
Gly2 Gly1 3 6 2
Gly3 Gly4 3 4 5
Gly4 Gly3 2 2 1
A vs B, or B vs A are the same... (7 Replies)
Discussion started by: nengcheng
7 Replies
7. UNIX for Beginners Questions & Answers
Hello All,
I am looking to write a script to count the number of a term and its opposite and create a new file with said list. I can get the terms to print to the file but only one or the other and not both.
I tried this:
grep -wi done */all.txt | grep -wiv done */all.txt > "filename"
... (5 Replies)
Discussion started by: mcesmcsc
5 Replies
LEARN ABOUT CENTOS
ncaport.conf
ncaport.conf(4) File Formats ncaport.conf(4)
NAME
ncaport.conf - ncaport configuration file
SYNOPSIS
/etc/nca/ncaport.conf
DESCRIPTION
The ncaport.conf file is used to configure the IP addresses and ports that the Solaris Network Cache and Acceleration (NCA) kernel module
services. The file contains two fields, key and value, in the format of ncaport=ipaddress/port. IPv4 addresses must be in the dot notation
d.d.d.d. IPv6 addresses must be in one of the three conventional forms (see inet_pton(3SOCKET)). If an asterisk (*) is used for an IP
address, it is interpreted as INADDR_ANY, which matches any IP address.
A web server uses the environment variable LD_PRELOAD and the ncaport.conf configuration file to convert an AF_INET socket to an AF_NCA
socket. LD_PRELOAD enables the NCA socket utility library to be loaded before libsocket.so.1. See the ncad_addr(4) for details. When a web
server issues the bind(3SOCKET) system call, it is intercepted by the interposition library ncad_addr.so. If the bind address is in the
ncaport.conf file, the AF_INET socket is converted to a AF_NCA socket.
EXAMPLES
Example 1: Sample ncaport.conf File
The following is a sample ncaport.conf file:
#
# NCA Kernel Module Port Configuration File
#
ncaport=1080:0:0:0:8:800:200C:417A/100
ncaport=192.168.84.71/80
ncaport=*/9000
SEE ALSO
nca(1), bind(3SOCKET), inet_pton(3SOCKET), ncad_addr(4), attributes(5)
NOTES
For those web servers that use AF_NCA sockets, the NCA port configuration described here has no effect.
NCA does not currently support IPv6. Any IPv6 addresses in the file ncaport.conf are ignored.
SunOS 5.10 30 Jul 2001 ncaport.conf(4)