ok guys thanks for your help finally got it work. appreciate it.

Something im confused about though, i didnt realise i had done it and dont understand why it works.

struct sockaddr_in *ad = (struct sockaddr_in *)addr;

and use ad-> to build the address.

but when i bind i dont use ad i used addr - Does this just mean ad points to addr and when i set the ad vars it changes and sets the addr vars?