Added possibility to wait for tcp signal before starting main