%% This parses a TCP packet header!<<SourcePort:16,DestinationPort:16,SequenceNumber:32,AckNumber:32,DataOffset:4,_Reserved:4,Flags:8,WindowSize:16,Checksum:16,UrgentPointer:16,Payload/binary>>=Segment,OptSize=(DataOffset-5)*32,<<Options:OptSize,Message/binary>>=Payload,<<CWR:1,ECE:1,URG:1,ACK:1,PSH:1,RST:1,SYN:1,FIN:1>>=<<Flags:8>>,%% Can now process the Message according to the %% Options (if any) and the flags CWR, …, FIN etc.

RPC with a Counter process

Multi-core

One scheduler per core, scales well to 32+ cores

Better scalability to more cores is in-progress

Schedulers understand IO (disk, network calls)

No implicit synchronization

%% Parse HTTP headers from Socketheaders(Socket,Request,Headers)->ok=inet:setopts(Socket,[{active,once}]),receive{http,_,http_eoh}->%% All of the HTTP headers are parsedhandle_request(Socket,Request,Headers);{http,_,{http_header,_,Name,_,Value}}->headers(Socket,Request,[{Name,Value}|Headers]);{tcp_closed,_}->exit(normal);_Other->%% Invalid requestexit(normal)after?HEADERS_RECV_TIMEOUT->exit(normal)end.