We cannot write a script for you however, best place to start would be..

/help Sockets
/help /sockwrite
/help /sockaccept
/help /sockopen
/help /sockclose
/help /sockmark
/help /socklis
/help /sockrename

and the events..

on SOCKCLOSE
on SOCKOPEN
on SOCKLISTEN
on SOCKREAD
on SOCKWRITE


As for the buttons, I assume you meant dialogs..
Code:
dialog updates.script {
  title "Updates script!"
  size -1 -1 110 100
  option dbu
  button  "Get updates!", 1, 30 50 50 24, ok tab 1
}

on 1:dialog:updates.script:sclick:1: {
  /help Sockets
}

on 1:dialog:updates.script:init:*: {
  echo -a What commands you want to perform before dialog opens
}

For more information

/help Dialogs
/help on Dialog
/help /Did
/help /Didtok


I hope this helps you in some way. grin