1)you need to use TCP/IP Protocol.
2)write one listner thread on server end.
3)when client login, client will send a message to server
4)server will keep listning for coming requests, so as server receive the request. server will see that either the request is of login type?
5)if request is of login, server will send response and login that perticular user (you need to send user info along with that specific msg)
6)same while logout, you will send specific string/msg to server along with your userName. server will listen and log you out from the server and response you back.
for code reference...
read chapter no 3 "Working with sockets" of book "Network programming in c#"
http://books.google.com.pk/books?id=ZmBzoG--oNAC&printsec=frontcover&dq=network+programming+in+c%23&hl=en&ei=2BOhTpvuHdCmrAfgsLCAAw&sa=X&oi=book_result&ct=result&resnum=2&ved=0CC8Q6AEwAQ#v=onepage&q&f=false[
^]