I Need Extra Help With Php Sockets

Im having alot of problems with the sockets, even after following the tutorial on the site. so Im hoping somebody can answer my questions.

1: I have a mac, so what do I do for the .bat file?
2: Which location should I put in the .bat file since I have a website
3: How should I upload the files? All in one directory or what?
4: How does the swf connect to the php file?