karuppiah7890 / go-redis

A Redis server written in Golang. A toy project
0 stars 0 forks source link

Implement `PING` command #1

Open karuppiah7890 opened 1 year ago

karuppiah7890 commented 1 year ago

Implement PING command

References:

karuppiah7890 commented 1 year ago

Experiments:

karuppiah@Karuppiahs-MacBook-Pro go-redis % redis-cli
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> 
karuppiah@Karuppiahs-MacBook-Pro go-redis % telnet 
telnet> port 6379 
?Invalid command
telnet> %                                                                                                             karuppiah@Karuppiahs-MacBook-Pro go-redis % telnet 6379
Trying 0.0.24.235...
telnet: connect to address 0.0.24.235: No route to host
telnet: Unable to connect to remote host
karuppiah@Karuppiahs-MacBook-Pro go-redis % telnet localhost 6379
Trying ::1...
Connected to localhost.
Escape character is '^]'.
PING
+PONG
^C^]
telnet> localhost 6379
?Invalid command
telnet> Connection closed.
karuppiah@Karuppiahs-MacBook-Pro go-redis % telnet               
telnet> connect
?Invalid command
telnet> ?
Commands may be abbreviated.  Commands are:

close       close current connection
logout      forcibly logout remote user and close the connection
display     display operating parameters
mode        try to enter line or character mode ('mode ?' for more)
telnet      connect to a site
open        connect to a site
quit        exit telnet
send        transmit special characters ('send ?' for more)
set         set operating parameters ('set ?' for more)
unset       unset operating parameters ('unset ?' for more)
status      print status information
toggle      toggle operating parameters ('toggle ?' for more)
slc         change state of special charaters ('slc ?' for more)
auth        turn on (off) authentication ('auth ?' for more)
z           suspend telnet
!           invoke a subshell
environ     change environment variables ('environ ?' for more)
?           print help information
telnet> open
(to) localhost
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host
telnet> telnet  
(to) localhost
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host
telnet> telnet
(to) localhost:6379
localhost:6379: nodename nor servname provided, or not known
telnet> telnet
(to) localhost 6379
Trying ::1...
Connected to localhost.
Escape character is '^]'.
PING
+PONG
SET blah 1003
+OK
GET blah
$4
1003
KEYS *
*1
$4
blah
SET bluetooth 1004
+OK
GET bluetooth
$4
1004
KEYS *
*2
$9
bluetooth
$4
blah
^C^]
telnet>