Guideline on making dedicated server

when should i connect client to server ? exactly at start ? look my game is like you go in a main menu and there is “free mode” which you can join to an session and the logic is that : if there is an available session , join to it . if not create one and let other join . so with that i have to connect them at exact time when they start game and then look for sessions and all this stuff ?