ConsultingJoe Posted September 14, 2007 Posted September 14, 2007 (edited) I made this because I needed a easy way to control the music of the computer next to me while I'm gaming.How to use:1.) Run the server on the target computer.2.) Run the client on the controlling computer.3.) Enter the target computer name in the client.4.) Run your favorite music player on the target computer.5.) Use the media keys on the client computer to change the music on the target computer.Keys available: (Pause/Play, Stop, Next, Previous)Enjoy!CLIENTexpandcollapse popupTCPStartUp() Dim $szServerPC = InputBox( "Remote Media Control Client", "Enter the server computer's network name." ) If @error Then Exit Dim $szIPADDRESS = TCPNameToIP($szServerPC) Dim $nPORT = 33891 Dim $ConnectedSocket = -1 $ConnectedSocket = TCPConnect($szIPADDRESS,$nPORT) Dim $szData If @error Then MsgBox(4112,"Error","TCPConnect failed with WSA error: " & @error) Else HotKeySet( "{MEDIA_PLAY_PAUSE}", "play" ) HotKeySet( "{MEDIA_STOP}", "stop" ) HotKeySet( "{MEDIA_NEXT}", "nextsong" ) HotKeySet( "{MEDIA_PREV}", "backsong" ) While 1 Sleep(100) WEnd EndIf Func play() sendcmd("play") EndFunc Func stop() sendcmd("stop") EndFunc Func nextsong() sendcmd("next") EndFunc Func backsong() sendcmd("back") EndFunc Func sendcmd($szData) TCPSend($ConnectedSocket,$szData) If @error Then Exit TCPSend($ConnectedSocket,"") If @error Then Exit EndFuncSERVERexpandcollapse popupDim $szIPADDRESS = @IPAddress1 Dim $nPORT = 33891 TCPStartUp() $MainSocket = TCPListen($szIPADDRESS, $nPORT) If $MainSocket = -1 Then Exit Dim $ConnectedSocket = -1 Do $ConnectedSocket = TCPAccept($MainSocket) Until $ConnectedSocket <> -1 Dim $szIP_Accepted = SocketToIP($ConnectedSocket) Dim $msg, $recv While 1 $recv = TCPRecv( $ConnectedSocket, 2048 ) If @error Then ExitLoop If $recv <> "" Then Switch $recv Case "play" Send("{MEDIA_PLAY_PAUSE}") Case "stop" Send("{MEDIA_STOP}") Case "next" Send("{MEDIA_NEXT}") Case "back" Send("{MEDIA_PREV}") EndSwitch EndIf WEnd If $ConnectedSocket <> -1 Then TCPCloseSocket( $ConnectedSocket ) TCPShutDown() Func SocketToIP($SHOCKET) Local $sockaddr = DLLStructCreate("short;ushort;uint;char[8]") Local $aRet = DLLCall("Ws2_32.dll","int","getpeername","int",$SHOCKET, _ "ptr",DLLStructGetPtr($sockaddr),"int_ptr",DLLStructGetSize($sockaddr)) If Not @error And $aRet[0] = 0 Then $aRet = DLLCall("Ws2_32.dll","str","inet_ntoa","int",DLLStructGetData($sockaddr,3)) If Not @error Then $aRet = $aRet[0] Else $aRet = 0 EndIf $sockaddr = 0 Return $aRet EndFunc Edited September 18, 2007 by CyberZeroCool Check out ConsultingJoe.com
Kreatorul Posted September 14, 2007 Posted September 14, 2007 2 bad I don't have 2 computers but the idea it's really cool Gives me a few other ideas.
ConsultingJoe Posted September 14, 2007 Author Posted September 14, 2007 2 bad I don't have 2 computers but the idea it's really cool Gives me a few other ideas.Thanks, yeah it seems to work great. Check out ConsultingJoe.com
ConsultingJoe Posted September 18, 2007 Author Posted September 18, 2007 Updated, was missing a few lines of code. check first post. Check out ConsultingJoe.com
BillLuvsU Posted September 18, 2007 Posted September 18, 2007 Hmmm.... This could be useful as hell for one of those audio systems that goes through the house, wit speakers every where, and is controlled by a computer. You could be all on you laptop, and be like "hey dude , watch this!" *click*, and an awesome song starts going through the house. oohhhh so cool. Or maybe add internet capabilitie so you could send messages star trek style home. And they could send it back o_0. Ok I'm getting off topic but that would be awesome.... [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw
ConsultingJoe Posted September 18, 2007 Author Posted September 18, 2007 Hmmm.... This could be useful as hell for one of those audio systems that goes through the house, wit speakers every where, and is controlled by a computer. You could be all on you laptop, and be like "hey dude , watch this!" *click*, and an awesome song starts going through the house. oohhhh so cool. Or maybe add internet capabilitie so you could send messages star trek style home. And they could send it back o_0. Ok I'm getting off topic but that would be awesome....Yeah, you can easily make it internet capable.Let's say you are bringing a date home, you can start the girls favorite song just as you walk in. What a turn on.And no, not a Trojan. Check out ConsultingJoe.com
BillLuvsU Posted September 18, 2007 Posted September 18, 2007 Don't see how you could send home a trojan through that but maybe. :shrugs: And ya, thats not a bad idea... *Runs to set up speakers throughout the house and add cellphone support...* [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now