Hai milisers,

Saat ini saya lagi belajar socket programming, untuk sementara ini
saya memanfaatkan service xinet.d sebagai inetd servernya. Berikut ini
service myhello yg dibangkitkan oleh xinetd.d:

cat /etc/xinetd.d/myhello
# default: on
# Tutorial Socket Programming
# http://www.troubleshooters.com/codecorn/sockets/
# description: Hello World socket server
service myhello
{
   disable = no
   port            = 3333
   socket_type     = stream
   wait            = no
   user            = nobody
   server          = /usr/local/sbin/myhello.sh
   log_on_success  += USERID
   log_on_failure  += USERID
}

Isi script /usr/local/sbin/myhello.sh

#!/bin/sh
/bin/echo -n "Hello World:" | /usr/bin/tee /tmp/log.log
/bin/date | /usr/bin/tee -a /tmp/log.log

Saya sudah berhasil konek dr komputer lain ke service tsb. Seperti ini
hasilnya:

# telnet 192.168.0.254 3333
Trying 192.168.0.254...
Connected to 192.168.0.254.
Escape character is '^]'.
Hello World:Thu Sep 28 10:18:49 WIT 2006
Connection closed by foreign host.

Kemudian saya ingin menambahkan fitur lain pd script myhello.sh tsb yaitu
mencatat ip client yg konek. Saya sudah baca2 xinetd.conf, di situ memang
ada pencatatan atau log untuk ip client yg konek ke service, tetapi saya
belum tahu caranya bagaimana script tsb bisa mencatat juga ip client 
yg konek, jadi inputnya nanti seperti ini:

# telnet 192.168.0.254 3333
Trying 192.168.0.254...
Connected to 192.168.0.254.
Escape character is '^]'.
Your ip is 192.168.0.100
Hello World:Thu Sep 28 10:18:49 WIT 2006
Connection closed by foreign host.

-- 

Terimakasih sebelumnya dan sesudahnya.

Salam,

~~ Arief Yudhawarman ~~


-- 
Berhenti langganan: [EMAIL PROTECTED]
Arsip dan info: http://linux.or.id/milis

Kirim email ke