works for tcp application