as i embark on my chat program... i have a winsock question..

i know how most examples use port 1001 or whatever.. but what if the port is used.... as in what if I set the server portion to listen at port 1001 but the client already has a program using that port.. so when my app tries it won't be able to... shoudl the server have a control array of winsocks? whats the best way to go about making sure it can use a valid port and handling the multiple incoming connections..