Code:
;open listening socket
alias startlisten socklisten listensocket 6667
;close listening socket
alias stoplisten sockclose listensocket
;close all accepted connections
alias closeall sockclose acceptsock*

;wait for incoming connections
on *:socklisten:listensocket:{
  if ($sockerr) { echo listenerror! | return }
  ;generate unique name
  var %name = acceptsocket $+ $ticks
  ;accept connection
  sockaccept %name
  ;use $sock to retreive info
  echo accepted connection from $sock(%name).ip
}

;wait for incoming data (note the wildcard, it will respond to any socket opened in the ON SOCKLISTEN)
on *sockread:acceptsock*:{
  if ($sockerr) { echo readerror! | return }
  echo Received data from $sock(%name).ip :
  ;read data
  sockread %line
  ;check if any data was read
  while ($sockbr) {
    ;echo data, and check for empty line
    echo $iif(%line,$ifmatch,[empty line])
    ;read next line
    sockread %line
  }
}

Now if you type /startlisten, people should be able to connect to you on port 6667 and any data they send will be echoed.

Note that is just the idea, and far from perfect (if they send you a number as data you'll get an error from echo for example smile )


$input(Me like stars, You too?)