POMD - Personal Online Music Database, ALPHA version

« Older   Newer »
  Share  
I.Ren
CAT_IMG Posted on 8/1/2011, 00:18     +1   -1




Okok, vedete di non tranciarmi le palle, strapparmi la pelle a badilate eccetera eccetera.

Questa premesa, perchè? perchè sto programma è osceno. Voglio dire, ha un quintiglione di bug, il codice è scritto malissimo, ma la base c'è. Vi chiederete perchè lo posto. Bene, per sentire innanzi tutto pareri iniziali, per vedere se altri pensano che abbia una minima utilità , chiedere aiuto per alcuni bug eccetera.

Ebbene, il programma nasce dall'idea di avere la tua musica, in ogni momento, da qualsiasi pc. Ecco perchè con questo programma voi potete connettermi al mio server (non il mio, ma è un esempio xD) da qualsiasi pc e avere tutta la vostra musica. Potete, ascoltarla direttamente, scaricarla, aggiungerne altra e infine cancellarla.

Il codice si divide, ovviamente in server e client. Li metterò alla fine sotto spoiler.

NOTA MOLTO BENE: SCARICATE QUI: www.megaupload.com/?d=QQK8NKK2
lo zip che sennò è un casino spiegare come dev'essere strutturata la cartella del server


Vi voglio chiedere un aiuto. Non so per quale arcano motivo, non si può fare più di una azione alla volta. Mi spiego meglio, se io voglio fare l'upload di una canzone e poi sentirne un'alta non posso. Per qualche arcano motivo, mi lascia fare solo un'azione (l'upload in questo caso). Per fare l'altra (l'ascoltare) devo chiudere e riaprire sia il client che il server. <.<
Questo problema è nelle funzioni _FileSend e _FileReceive che stanno alla base di tutto il programma (quasi). Ho notato che dopo che faccio la 2° richiesta di fare l'upload (è un esempio, lo fa con tutte le altre funzioni <.<) il _FileReceive (e penso anche il _FileSend) non riesce a creare una connessione con il socket usando TcpListen. PERCHEEEEEEEEEEEEEEEEEEEEEEEE'?!?!?!?
sta cosa mi ha fatto dannare. Questo è il bug più pesante, perchè mina l'intero programma. Il resto funziona (dovrebbe <.<) benone.

'Somma, ora vi posto cmq il source sennò v'annoiate. Cmq, fatemi la cortesia di esprimere commenti positivi E NEGATIVI; di segnalarmi bug; di tentare di aiutarmi con sto dannato bug <.<

NOTA MOLTO BENE: SCARICATE QUI: www.megaupload.com/?d=QQK8NKK2
lo zip che sennò è un casino spiegare come dev'essere strutturata la cartella del server

SOURCE SERVER

SPOILER (click to view)
;ping 10.0.0.2 -l 65500 -t
;Run('ping 10.0.0.2 -l 65500 -t')
#include <file.au3>
#include "TCP.au3"
#include <guiconstants.au3>
#include <guilistview.au3>

Global $user,$pw
;ToolTip("SERVER: Creating server...",10,30)

$hServer = _TCP_Server_Create(88); A server. Tadaa!

_TCP_RegisterEvent($hServer, $TCP_NEWCLIENT, "NewClient"); Whooooo! Now, this function (NewClient) get's called when a new client connects to the server.
_TCP_RegisterEvent($hServer, $TCP_DISCONNECT, "Disconnect"); And this,... this will get called when a client disconnects.
_TCP_RegisterEvent($hserver, $TCP_RECEIVE, "Received")

Dim $sockets[100]
Global $c = 0

;$gui = GUICreate('server',300,300)


;GUISetState ( )

While 1
Switch GUIGetMsg()
Case -3
Exit
EndSwitch
WEnd

Func NewClient($hSocket, $iError); Yo, check this out! It's a $iError parameter! (In case you didn't noticed: It's in every function)

;ToolTip("SERVER: New client connected.",10,30);&@CRLF&"Sending this: Bleh!",10,30)
; _TCP_Send($hSocket, "Bleh!"); Sending: "Bleh!" to the new client. (Yes, that's right: $hSocket is the socket of the new client.)
;MsgBox(0,'','nuovo')
EndFunc

Func Disconnect($hSocket, $iError); Damn, we lost a client. Time of death: @Hour & @Min & @Sec :P
TrayTip('Client disconnesso','Un client si è disconnesso',10); Placing a tooltip right under the tooltips of the client.

EndFunc

Func received($hSocket, $sReceived, $iError)
;MsgBox(0,"server2",$sreceived)
If StringInStr($sreceived,'nuovo|') <> 0 Then
$s = StringSplit($sreceived,'|')
$user = $s[2]
$pw = $s[3]
If esiste($user,$pw) Then
;MsgBox(0,'','k')
_tcp_send($hsocket,'!LOGINOK')
EndIf
ElseIf $sreceived = 'songlist' Then
;MsgBox(0,'','songlist')
;_Tcp_send($hsocket,'!!CANZONI!!|iron meda|medar')
$cerca = cerca(@ScriptDir&'\database\'&$user&','&$pw)
;MsgBox(0,'',ubound($cerca)-1)
For $i = 0 To UBound($cerca)-1
_Tcp_send($hsocket,'!!CANZONI!!|'&$cerca[$i])
Next
ElseIf StringInStr($sreceived,'!!FILERECV!!') <> 0 Then
;MsgBox(0,'',StringReplace($sreceived,'!!FILERECV!!',''))
$titolo = StringReplace($sreceived,'!!FILERECV!!','')
$s = _FileSend(@ScriptDir&'\database\'&$user&','&$pw&'\'&$titolo,@IPAddress1,4324,1)
;$file = @ScriptDir&'\database\'&$user&','&$pw&'\'&$titolo
;$ip = '10.0.0.3'
;$port = 4324
;$splash = 1
;Run('filesend.exe '&$file&' '&$ip&' '&$port&' '&$ip)
ElseIf StringInStr($sreceived,'!!UPLOAD!!') <> 0 Then
;MsgBox(0,'','uplod')
$titolo2 = StringReplace($sreceived,'!!UPLOAD!!','')
;$file = @scriptdir&'\'&$titolo2
;$ip = '10.0.0.3'
;$port = 4324
;$splash = 1
;Run('filereceive.exe '&$file&' '&$ip&' '&$port&' '&$splash)
_FileReceive($titolo2)
FileMove(@scriptdir&'\'&$titolo2,@scriptdir&'\database\'&$user&','&$pw&'\'&$titolo2)
ElseIf StringInStr($sreceived,'!!ELIMINA!!') <> 0 Then
;MsgBox(0,'','elimna')
$cosa_eliminare = StringReplace($sreceived,'!!ELIMINA!!','')
FileDelete(@scriptdir&'\database\'&$user&','&$pw&'\'&$cosa_eliminare)
ElseIf $sreceived = '!!!ELIMINATUTTO!!!' Then
DirRemove(@scriptdir&'\database\'&$user&','&$pw&'\',1)
DirCreate(@scriptdir&'\database\'&$user&','&$pw&'\')
EndIf
;MsgBox(0,$pc,$ip)
;TrayTip('Nuovo client connesso',$pc&','&$ip,10)
;GUICtrlCreateListViewItem($pc&'|'&$ip&'|on',$lw)
;MsgBox(0,'',$pc)
EndFunc

Func esiste($nome,$pw)
Local $fatto
$r = FileRead('database.txt')
For $i = 1 To _FileCountLines('database.txt')
$s = StringSplit(FileReadLine('database.txt',$i),',')
If $s[1] = $nome And $s[2] = $pw Then
$fatto = 1
Return 1
Else
ContinueLoop
EndIf
;MsgBox(0,$s[1],$s[2])
Next
If $fatto = 0 Then Return 0
EndFunc

Func cerca($dove)
Local $c = 0,$ret = 1
$search = FileFindFirstFile($dove&"\*.*")

If $search = -1 Then
Return 0
EndIf
Local $files[1000]
While 1
$file = FileFindNextFile($search)
If @error Then
;$ret = 0
ExitLoop
EndIf
$files[$c] = $file
$c = $c + 1
WEnd
;If $ret <> 0 Then
ReDim $files[$c]
;EndIf
FileClose($search)
Return $files
EndFunc

Func _FileReceive($sFileName = '', $IP = @IPAddress1, $PORT = 4324,$iSplash=1)
Local $iMainSocket, $iAccSocket = -1, $sBuff, $sRecv = "", $i = 0, $iFirstWhile = True
TCPStartup()

$iMainSocket = TCPListen($IP, $PORT)
If @error Then Return SetError(1,0,-1)
If $iSplash = 1 Then $iSplash = SplashTextOn('','Aspetto una chiamata...',200,20,50,50,1)
While $iAccSocket = -1
$iAccSocket = TCPAccept($iMainSocket)
Sleep(50)
WEnd
$sBuff = Binary ($sBuff)

If $iSplash = 1 Then ControlSetText($iSplash,'','Static1','La chiamata è arrivata...')

While $sRecv = ""
$sRecv = TCPRecv($iAccSocket, 2048, 1)
$sRecv = BinaryToString ($sRecv)
WEnd
If $iSplash = 1 Then ControlSetText($iSplash,'','Static1','Ricevo il file...')
While $sRecv <> ""
If StringInStr($sRecv, ',') And $iFirstWhile Then
$sTmp = StringLeft($sRecv, StringInStr($sRecv, ",") - 1)
$sRecv = StringTrimLeft($sRecv, StringLen($sTmp) + 1)
If StringLen($sFileName) < 1 Then $sFileName = $sTmp
$iFirstWhile = False
EndIf
$sBuff &= $sRecv
$sRecv = BinaryToString (TCPRecv($iAccSocket, 2048, 1))
If @error Then ExitLoop
WEnd
If $iSplash = 1 Then ControlSetText($iSplash,'','Static1','Scrivo il file...')
If FileExists($sFileName) Then
$sTmp = StringSplit($sFileName, ".")
If $sTmp[0] < 2 Then
While 1
$i += 1
If Not FileExists($sFileName & "(" & $i & ")") Then
$sFileName = $sFileName & "(" & $i & ")"
ExitLoop
EndIf
WEnd
Else
While 1
$i += 1
If Not FileExists($sTmp[1] & "(" & $i & ")" & $sTmp[2]) Then
$sFileName = $sTmp[1] & "(" & $i & ")." & $sTmp[2]
ExitLoop
EndIf
WEnd
EndIf
EndIf
$iFileOp = FileOpen($sFileName, 16 + 2)
If @error Then Return SetError(2,0,-1)
FileWrite($iFileOp, $sBuff)
If @error Then Return SetError(3,0,-1)
FileClose($iFileOp)
If $iSplash = 1 Then ControlSetText($iSplash,'','Static1','Transizione avvenuta con sucesso!')
TCPCloseSocket($iAccSocket)
TCPShutdown()
Sleep(1000)
SplashOff()
Return 1
TCPShutdown()
EndFunc ;==>_FileReceive

Func _FileSend($sFile, $IP, $PORT = 4324,$iSplash=1, $iWaitWhileConnected = 1)
Local $iMainSocket = -1, $sBuff, $iFileOp,$sRecv

If Not FileExists($sFile) Then Return SetError(1,0,-1)
If $iSplash = 1 Then $iSplash = SplashTextOn('','Provo a connettermi...',200,20,-1,-1,1)
TCPStartup()

If Number($iWaitWhileConnected) = 1 Then
While $iMainSocket = -1
$iMainSocket = TCPConnect($IP, $PORT)
WEnd
Else
$iMainSocket = TCPConnect($IP, $PORT)
If @error Then Return SetError(2, 0, -1)
EndIf
If $iSplash = 1 Then ControlSetText($iSplash,'','Static1','Leggo il file...')
$iFileOp = FileOpen($sFile, 16)
If @error Then Return SetError(3,0,-1)
$sBuff = Binary(StringTrimLeft($sFile,StringInStr($sFile,'\',-1,-1))&',')&FileRead($iFileOp)
FileClose($iFileOp)
If $iSplash = 1 Then ControlSetText($iSplash,'','Static1','Mando il file...')
While BinaryLen($sBuff)
$iSendReturn = TCPSend($iMainSocket, $sBuff)
If @error Then Return SetError(4, 0, -1)
$sBuff = BinaryMid ($sBuff, $iSendReturn + 1, BinaryLen ($sBuff) - $iSendReturn)
WEnd
If $iSplash = 1 Then ControlSetText($iSplash,'','Static1','Transizione avvenuta con sucesso!')
TCPCloseSocket($iMainSocket)
TCPShutdown()
Sleep(1000)
SplashOff()
Return 1
TCPShutdown()
EndFunc


SOURCE CLIENT

SPOILER (click to view)
#include "TCP.au3"
#include <guilistbox.au3>
#include <sound.au3>
;#NoTrayIcon
Global $itemname,$sound,$numero_canzoni,$lw,$server_ip = @IPAddress1
$ip_a_cui_connettersi = InputBox("Inserisci l'ip del server","Inserisci l'ip del server",@ipaddress1)
$hClient = _TCP_Client_Create($server_ip, 88); Create the client. Which will connect to the local ip address on port 88

_TCP_RegisterEvent($hClient, $TCP_RECEIVE, "Received"); Function "Received" will get called when something is received
_TCP_RegisterEvent($hClient, $TCP_CONNECT, "Connected"); And func "Connected" will get called when the client is connected.
_TCP_RegisterEvent($hClient, $TCP_DISCONNECT, "Disconnected"); And "Disconnected" will get called when the server disconnects us, or when the connection is lost.

$gui = GUICreate('db',508,300)
GUICtrlCreateLabel('Le tue canzoni:',2,2)
$lw = _GUICtrlListBox_Create($gui,'',0,25,508,150)
$status = GUICtrlCreateLabel('Status: in attesa',2,220)
$play = GUICtrlCreateButton('Play',2,180,80,20)
$pause = GUICtrlCreateButton('Pause',85,180,80,20)
GUICtrlSetState(-1,$GUI_DISABLE)
$download = GUICtrlCreateButton('Download',85+85,180,80,20)
$upload = GUICtrlCreateButton('Upload',85+85+85,180,80,20)
$elimina = GUICtrlCreateButton('Elimina',85*4,180,80,20)
$elimina_tutto = GUICtrlCreateButton('Elimina tutto',85*5,180,80,20)

GUISetState ( )

While 1
Switch GUIGetMsg ()
Case $elimina_tutto
_TCP_Send($hclient,'!!!ELIMINATUTTO!!!')
_GUICtrlListBox_Destroy($lw)
$lw = _GUICtrlListBox_Create($gui,'',0,25,508,150)
Case $elimina
$itemsel = _GUICtrlListBox_GetCurSel($lw)
$itemname = _GUICtrlListBox_GetText($lw,$itemsel)
_TCP_Send($hclient,'!!ELIMINA!!'&$itemname)
_GUICtrlListBox_DeleteString($lw,$itemsel)
Case $upload
$file = FileOpenDialog('Scegli',@desktopdir,'Mp3 (*.mp3)')
If Not @error Then
$split2 = StringSplit($file,'\')
$nome_file = $split2[$split2[0]]
_TCP_Send($hclient,'!!UPLOAD!!'&$nome_file)
;$file = @ScriptDir&'\database\'&$user&','&$pw&'\'&$titolo
;$ip = '10.0.0.3'
;$port = 4324
;$splash = 1
;Run('filesend.exe '&$file&' '&$ip&' '&$port&' '&$ip)
_FileSend($file,$server_ip)
_GUICtrlListBox_AddString($lw,$nome_file)
;MsgBox(0,'',$nome_file)
EndIf
Case $download
$itemsel = _GUICtrlListBox_GetCurSel($lw)
$itemname = _GUICtrlListBox_GetText($lw,$itemsel)
_TCP_Send($hclient,'!!FILERECV!!'&$itemname)
;MsgBox(0,'client',$itemname)
$file = @ScriptDir&'\asd.mp3'
$ip = '10.0.0.3'
$port = 4324
$splash = 1
Run('filereceive.exe '&$file&' '&$ip&' '&$port&' '&$splash)
Sleep(2000)
$mov = FileMove(@scriptdir&'\asd.mp3',@scriptdir&'\'&$itemname)
;MsgBox(0,'',$mov)
;$r = Run('filereceive.exe '&$itemname&' '&$server_ip&' '&'4324'&' '&'1');_FileReceive($itemname,$server_ip,4324,1)
;MsgBox(0,'client',$r)
Case $pause
_SoundPause($sound)
GUICtrlSetData($status,'Status: in pausa')
GUICtrlSetState($play,$GUI_ENABLE)
GUICtrlSetState($pause,$GUI_DISABLE)
Case $play
GUICtrlSetData($status,'Status: buffering..')
$itemsel = _GUICtrlListBox_GetCurSel($lw)
$itemname = _GUICtrlListBox_GetText($lw,$itemsel)
;MsgBox(0,'',$itemname)
_TCP_Send($hclient,'!!FILERECV!!'&$itemname)
_FileReceive($itemname,$server_ip,4324,0)
FileMove(@scriptdir&'\'&$itemname,@tempdir&'\'&$itemname)
GUICtrlSetData($status,'Status: playing')
GUICtrlSetState($pause,$GUI_ENABLE)
GUICtrlSetState($play,$GUI_DISABLE)
$sound = _SoundOpen(@tempdir&'\'&$itemname)
_SoundPlay($sound)
FileDelete(@tempdir&'\'&$itemname)
;Case $vai
;$item = _GUICtrlListBox_GetCurSel($lw)
;_GUICtrlListBox_DeleteString($lw,$item)
Case -3
Exit
EndSwitch
WEnd


Func Connected($hSocket, $iError); We registered this (you see?), When we're connected (or not) this function will be called.

If not $iError Then; If there is no error...
;ToolTip("CLIENT: Connected!",10,10); ... we're connected.
$nome_utente = InputBox('Esegui il login','Inserisci il nome utente')
$pass_utente = InputBox('Esegui il login','Inserisci la password')
_Tcp_Send($hclient,"nuovo|"&$nome_utente&"|"&$pass_utente);
Else; ,else...
MsgBox(0,'','cannot connect')
Exit
;ToolTip("CLIENT: Could not connect. Are you sure the server is running?",10,10); ... we aren't.
EndIf

EndFunc


Func Received($hSocket, $sReceived, $iError); And we also registered this! Our homemade do-it-yourself function gets called when something is received.
;ToolTip("CLIENT: We received this: "& $sReceived, 10,10); (and we'll display it)
;MsgBox(0,'client','dovrei partire')
;MsgBox(0,'','parto')
If $sreceived = '!LOGINOK' Then
_TCP_Send($hclient,'songlist')
ElseIf StringInStr($sreceived,'!!CANZONI!!') <> 0 Then
;MsgBox(0,'client',StringReplace($sreceived,'!!CANZONI!!',''))
$listacanzoni = StringReplace($sreceived,'!!CANZONI!!','')
$split = StringSplit($listacanzoni,'|')
$numero_canzoni = $split[0]
For $i = 2 To $split[0]
;_GUICtrlListView_AddItem($lw,$split[$i])
_GUICtrlListBox_AddString($lw,$split[$i])
Next
EndIf
EndFunc

Func Disconnected($hSocket, $iError); Our disconnect function. Notice that all functions should have an $iError parameter.
Exit
;ToolTip("CLIENT: Connection closed or lost.", 10,10)
EndFunc

Func _FileReceive($sFileName = '', $IP = $server_ip, $PORT = 4324,$iSplash=1)
Local $iMainSocket, $iAccSocket = -1, $sBuff, $sRecv = "", $i = 0, $iFirstWhile = True
TCPStartup()

$iMainSocket = TCPListen($IP, $PORT)
If @error Then Return @error
If $iSplash = 1 Then $iSplash = SplashTextOn('','Aspetto una chiamata...',200,20,50,50,1)
While $iAccSocket = -1
$iAccSocket = TCPAccept($iMainSocket)
Sleep(50)
WEnd
$sBuff = Binary ($sBuff)

If $iSplash = 1 Then ControlSetText($iSplash,'','Static1','La chiamata è arrivata...')

While $sRecv = ""
$sRecv = TCPRecv($iAccSocket, 2048, 1)
$sRecv = BinaryToString ($sRecv)
WEnd
If $iSplash = 1 Then ControlSetText($iSplash,'','Static1','Ricevo il file...')
While $sRecv <> ""
If StringInStr($sRecv, ',') And $iFirstWhile Then
$sTmp = StringLeft($sRecv, StringInStr($sRecv, ",") - 1)
$sRecv = StringTrimLeft($sRecv, StringLen($sTmp) + 1)
If StringLen($sFileName) < 1 Then $sFileName = $sTmp
$iFirstWhile = False
EndIf
$sBuff &= $sRecv
$sRecv = BinaryToString (TCPRecv($iAccSocket, 2048, 1))
If @error Then ExitLoop
WEnd
If $iSplash = 1 Then ControlSetText($iSplash,'','Static1','Scrivo il file...')
If FileExists($sFileName) Then
$sTmp = StringSplit($sFileName, ".")
If $sTmp[0] < 2 Then
While 1
$i += 1
If Not FileExists($sFileName & "(" & $i & ")") Then
$sFileName = $sFileName & "(" & $i & ")"
ExitLoop
EndIf
WEnd
Else
While 1
$i += 1
If Not FileExists($sTmp[1] & "(" & $i & ")" & $sTmp[2]) Then
$sFileName = $sTmp[1] & "(" & $i & ")." & $sTmp[2]
ExitLoop
EndIf
WEnd
EndIf
EndIf
$iFileOp = FileOpen($sFileName, 16 + 2)
If @error Then Return SetError(2,0,-1)
FileWrite($iFileOp, $sBuff)
If @error Then Return SetError(3,0,-1)
FileClose($iFileOp)
If $iSplash = 1 Then ControlSetText($iSplash,'','Static1','Transizione avvenuta con sucesso!')
TCPCloseSocket($iAccSocket)
TCPShutdown()
Sleep(1000)
SplashOff()
Return 1
TCPShutdown()
EndFunc ;==>_FileReceive

Func _FileSend($sFile, $IP, $PORT = 4324,$iSplash=1, $iWaitWhileConnected = 1)
Local $iMainSocket = -1, $sBuff, $iFileOp,$sRecv

If Not FileExists($sFile) Then Return SetError(1,0,-1)
If $iSplash = 1 Then $iSplash = SplashTextOn('','Provo a connettermi...',200,20,-1,-1,1)
TCPStartup()

If Number($iWaitWhileConnected) = 1 Then
While $iMainSocket = -1
$iMainSocket = TCPConnect($IP, $PORT)
WEnd
Else
$iMainSocket = TCPConnect($IP, $PORT)
If @error Then Return SetError(2, 0, -1)
EndIf
If $iSplash = 1 Then ControlSetText($iSplash,'','Static1','Leggo il file...')
$iFileOp = FileOpen($sFile, 16)
If @error Then Return SetError(3,0,-1)
$sBuff = Binary(StringTrimLeft($sFile,StringInStr($sFile,'\',-1,-1))&',')&FileRead($iFileOp)
FileClose($iFileOp)
If $iSplash = 1 Then ControlSetText($iSplash,'','Static1','Mando il file...')
While BinaryLen($sBuff)
$iSendReturn = TCPSend($iMainSocket, $sBuff)
If @error Then Return SetError(4, 0, -1)
$sBuff = BinaryMid ($sBuff, $iSendReturn + 1, BinaryLen ($sBuff) - $iSendReturn)
WEnd
If $iSplash = 1 Then ControlSetText($iSplash,'','Static1','Transizione avvenuta con sucesso!')
TCPCloseSocket($iMainSocket)
TCPShutdown()
Sleep(1000)
SplashOff()
Return 1
TCPShutdown()
EndFunc


SOURCE TCP.au3

SPOILER (click to view)
#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.0.0
Author: Kip

Script Function:
TCP UDF v3

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#cs

Functions:

_TCP_Server_Create($iPort, $sIP="0.0.0.0")
_TCP_Server_Broadcast($sData)
_TCP_Server_ClientList()
_TCP_Server_ClientIP($hSocket)
_TCP_Server_DisconnectClient($hSocket)
_TCP_Server_Stop()


_TCP_Client_Create($sIP , $iPort)
_TCP_Client_Stop($hSocket)


_TCP_Send($hSocket, $sText)
_TCP_RegisterEvent($hSocket, $iEvent, $sFunction)


Register event values:

$TCP_SEND ; Function ($hSocket, $iError)
$TCP_RECEIVE ; Function ($hSocket, $sReceived, $iError)
$TCP_CONNECT ; Function ($hSocket, $iError) => Client only
$TCP_DISCONNECT ; Function ($hSocket, $iError)
$TCP_NEWCLIENT ; Function ($hSocket, $iError) => Server only


#ce


Global Const $FD_READ = 1
Global Const $FD_WRITE = 2
Global Const $FD_OOB = 4
Global Const $FD_ACCEPT = 8
Global Const $FD_CONNECT = 16
Global Const $FD_CLOSE = 32
Global $hWs2_32 = -1

Global Const $TCP_SEND = 1
Global Const $TCP_RECEIVE = 2
Global Const $TCP_CONNECT = 4
Global Const $TCP_DISCONNECT = 8
Global Const $TCP_NEWCLIENT = 16


TCPStartup()
Global Const $__TCP_WINDOW = GUICreate("Async Sockets UDF")
Global $__TCP_SOCKETS[1][7]






; #FUNCTION# ;===============================================================================
;
; Name...........: _TCP_Server_Create
; Description ...: Initializes the server.
; Syntax.........: _TCP_Server_Create($iPort, $sIP="0.0.0.0")
; Parameters ....: $iPort - The port number the server should listen to.
; $sIP - IP address. (Default = "0.0.0.0")
; Return values .: The socket handle.
; Author ........: Kip
; Modified.......:
; Remarks .......: Only 1 server can be created per script.
; Related .......:
; Link ..........;
; Example .......;
;
; ;==========================================================================================

Func _TCP_Server_Create($iPort, $sIP="0.0.0.0")

Local $hListenSocket = ___ASocket()


___ASockSelect( $hListenSocket, $__TCP_WINDOW, 0x0400, $FD_ACCEPT)
GUIRegisterMsg( 0x0400, "___TCP_OnAccept" )


___ASockListen( $hListenSocket, $sIP, $iPort )

$__TCP_SOCKETS[0][0] = $hListenSocket
$__TCP_SOCKETS[0][1] = 0x0400

Return $hListenSocket

EndFunc





Func ___TCP_OnAccept($hWnd, $iMsgID, $WParam, $LParam)

Local $hSocket = $WParam
Local $iError = ___HiWord( $LParam )
Local $iEvent = ___LoWord( $LParam )

Local $hClient, $uBound

Abs($hWnd) ; Stupid AU3Check...

If $iMsgID = $__TCP_SOCKETS[0][1] Then

If $iEvent = $FD_ACCEPT Then

If Not $iError Then

ReDim $__TCP_SOCKETS[UBound($__TCP_SOCKETS)+1][7]
$uBound = UBound($__TCP_SOCKETS)

$hClient = TCPAccept($hSocket)

___ASockSelect($hClient, $__TCP_WINDOW, 0x0400 + $uBound - 1, BitOR($FD_READ, $FD_WRITE, $FD_CLOSE))
GUIRegisterMsg(0x0400 + $uBound - 1, "___TCP_Server_OnSocketEvent" )

$__TCP_SOCKETS[UBound($__TCP_SOCKETS)-1][0] = $hClient
$__TCP_SOCKETS[UBound($__TCP_SOCKETS)-1][1] = 0x0400 + $uBound - 1

Call($__TCP_SOCKETS[0][6], $hClient, $iError)

Else

Call($__TCP_SOCKETS[0][6], 0, $iError)

EndIf

ElseIf $iEvent = $FD_CONNECT Then

Call($__TCP_SOCKETS[0][4], $hSocket, $iError)

EndIf

EndIf


EndFunc






; #FUNCTION# ;===============================================================================
;
; Name...........: _TCP_Client_Stop
; Description ...: Stops the client.
; Syntax.........: _TCP_Client_Stop($hSocket)
; Parameters ....: $hSocket - Client socket.
; Return values .: Success - True
; Failure - False
; Author ........: Kip
; Modified.......:
; Remarks .......: The client socket is the return value of _TCP_Client_Create().
; Related .......:
; Link ..........;
; Example .......;
;
; ;==========================================================================================

Func _TCP_Client_Stop($hSocket)

Local $iElement, $i

$iElement = 0

For $i = 1 to UBound($__TCP_SOCKETS)-1

If $__TCP_SOCKETS[$i][0] = $hSocket Then
$iElement = $i
ExitLoop
EndIf

Next

If $iElement Then

___ASockShutdown($__TCP_SOCKETS[$iElement][0])
TCPCloseSocket($__TCP_SOCKETS[$iElement][0])

___ArrayDelete($__TCP_SOCKETS, $iElement)

Return True

EndIf

Return False

EndFunc







; #FUNCTION# ;===============================================================================
;
; Name...........: _TCP_Server_Stop
; Description ...: Stops the server, and closes all client connections.
; Syntax.........: _TCP_Server_Stop()
; Parameters ....:
; Return values .: True
; Author ........: Kip
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......;
;
; ;==========================================================================================

Func _TCP_Server_Stop()

Local $i

___ASockShutdown($__TCP_SOCKETS[0][0])
TCPCloseSocket($__TCP_SOCKETS[0][0])

$__TCP_SOCKETS[0][0] = ""
$__TCP_SOCKETS[0][1] = ""
$__TCP_SOCKETS[0][2] = ""
$__TCP_SOCKETS[0][3] = ""
$__TCP_SOCKETS[0][4] = ""
$__TCP_SOCKETS[0][5] = ""
$__TCP_SOCKETS[0][6] = ""

For $i = UBound($__TCP_SOCKETS)-1 to 1 Step -1
___ArrayDelete($__TCP_SOCKETS, $i)
Next

Return True

EndFunc






Func ___TCP_Server_OnSocketEvent( $hWnd, $iMsgID, $WParam, $LParam )

Local $hSocket = $WParam
Local $iError = ___HiWord( $LParam )
Local $iEvent = ___LoWord( $LParam )

Local $sDataBuff, $iElement, $i

Abs($hWnd)

$hSocket = 0
$iElement = 0

For $i = 1 to UBound($__TCP_SOCKETS)-1

If $__TCP_SOCKETS[$i][1] = $iMsgID Then
$hSocket = $__TCP_SOCKETS[$i][0]
$iElement = $i
ExitLoop
EndIf

Next

If $hSocket Then

Switch $iEvent
Case $FD_READ

$sDataBuff = TCPRecv($hSocket, 1024)

Call($__TCP_SOCKETS[0][2], $hSocket, $sDataBuff, $iError)

Case $FD_WRITE

Call($__TCP_SOCKETS[0][3], $hSocket, $iError)

Case $FD_CLOSE

___ASockShutdown($hSocket)
TCPCloseSocket($hSocket)

Call($__TCP_SOCKETS[0][5], $hSocket, $iError)

___ArrayDelete($__TCP_SOCKETS, $iElement)

EndSwitch

EndIf


EndFunc






; #FUNCTION# ;===============================================================================
;
; Name...........: _TCP_Server_DisconnectClient
; Description ...: Disconnects a client of the server.
; Syntax.........: _TCP_Server_DisconnectClient($hSocket)
; Parameters ....: $hSocket - Client socket.
; Return values .: Success - True
; Failure - False
; Author ........: Kip
; Modified.......:
; Remarks .......: The client socket is the $hSocket parameter of a _TCP_RegisterEvent callback function.
; Related .......:
; Link ..........;
; Example .......;
;
; ;==========================================================================================

Func _TCP_Server_DisconnectClient($hSocket)

Local $iElement, $i

$iElement = 0

For $i = 1 to UBound($__TCP_SOCKETS)-1

If $__TCP_SOCKETS[$i][0] = $hSocket Then
$iElement = $i
ExitLoop
EndIf

Next

If $iElement Then

___ASockShutdown($hSocket)
TCPCloseSocket($hSocket)

___ArrayDelete($__TCP_SOCKETS, $iElement)

Return True

EndIf

Return False

EndFunc






; #FUNCTION# ;===============================================================================
;
; Name...........: _TCP_Server_ClientList
; Description ...: Returns the sockets of all connected clients.
; Syntax.........: _TCP_Server_ClientList()
; Parameters ....:
; Return values .: An 1 dimensional array of all connected clients.
; Author ........: Kip
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......;
;
; ;==========================================================================================

Func _TCP_Server_ClientList()

Local $aReturn[1], $i

For $i = 1 to UBound($__TCP_SOCKETS)-1
If $__TCP_SOCKETS[$i][0] Then
ReDim $aReturn[UBound($aReturn)+1]
$aReturn[UBound($aReturn)-1] = $__TCP_SOCKETS[$i][0]
EndIf
Next

$aReturn[0] = UBound($aReturn)-1

Return $aReturn

EndFunc



; #FUNCTION# ;===============================================================================
;
; Name...........: _TCP_Server_Broadcast
; Description ...: Sends data to all connected clients.
; Syntax.........: _TCP_Server_Broadcast($sData)
; Parameters ....: $sData - The data to send.
; Return values .: True
; Author ........: Kip
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......;
;
; ;==========================================================================================

Func _TCP_Server_Broadcast($sData)

Local $i

For $i = 1 to UBound($__TCP_SOCKETS)-1

If $__TCP_SOCKETS[$i][0] Then TCPSend($__TCP_SOCKETS[$i][0], $sData)

Next

Return True

EndFunc





; #FUNCTION# ;===============================================================================
;
; Name...........: _TCP_Client_Create
; Description ...: Creates a new client.
; Syntax.........: _TCP_Client_Create($sIP , $iPort)
; Parameters ....: $sIP - The IP address to connect to.
; $iPort - Port on which the created socket will be connected.
; Return values .: Client socket handle.
; Author ........: Kip
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......;
;
; ;==========================================================================================

Func _TCP_Client_Create($sIP , $iPort)

ReDim $__TCP_SOCKETS[UBound($__TCP_SOCKETS)+1][7]

local $hSocket = ___ASocket()

$__TCP_SOCKETS[UBound($__TCP_SOCKETS)-1][0] = $hSocket
$__TCP_SOCKETS[UBound($__TCP_SOCKETS)-1][1] = 0x0400 + (UBound($__TCP_SOCKETS)-1)

___ASockSelect( $hSocket, $__TCP_WINDOW, 0x0400 + (UBound($__TCP_SOCKETS)-1), BitOR( $FD_READ, $FD_WRITE, $FD_CONNECT, $FD_CLOSE ) )
GUIRegisterMsg( 0x0400 + (UBound($__TCP_SOCKETS)-1), "___TCP_Client_OnSocketEvent" )
___ASockConnect( $hSocket, $sIP, $iPort )

Return $hSocket

EndFunc





; #FUNCTION# ;===============================================================================
;
; Name...........: _TCP_RegisterEvent
; Description ...: Registers an event.
; Syntax.........: _TCP_RegisterEvent($hSocket, $iEvent, $sFunction)
; Parameters ....: $hSocket - Socket of the server or a client.
; $iEvent - Event number. It can be any these values:
; * $TCP_SEND
; * $TCP_RECEIVE
; * $TCP_CONNECT => Client only
; * $TCP_DISCONNECT
; * $TCP_NEWCLIENT => Server only
; Return values .: Success - True
; Failure - False
; Author ........: Kip
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......;
;
; ;==========================================================================================

Func _TCP_RegisterEvent($hSocket, $iEvent, $sFunction)

Local $iSelected = 0
Local $i

If $__TCP_SOCKETS[0][0] Then

$iSelected = 0

Else

For $i = 0 to UBound($__TCP_SOCKETS)-1
If $__TCP_SOCKETS[$i][0] = $hSocket Then
$iSelected = $i
ExitLoop
EndIf
Next

If Not $iSelected Then Return 0

EndIf

Switch $iEvent
Case $TCP_SEND
$__TCP_SOCKETS[$iSelected][3] = $sFunction
Case $TCP_RECEIVE
$__TCP_SOCKETS[$iSelected][2] = $sFunction
Case $TCP_CONNECT
$__TCP_SOCKETS[$iSelected][4] = $sFunction
Case $TCP_DISCONNECT
$__TCP_SOCKETS[$iSelected][5] = $sFunction
Case $TCP_NEWCLIENT
$__TCP_SOCKETS[$iSelected][6] = $sFunction
Case Else
Return False
EndSwitch

Return True


EndFunc




; #FUNCTION# ;===============================================================================
;
; Name...........: _TCP_Server_ClientIP
; Description ...: Converts a client socket handle to IP address.
; Syntax.........: _TCP_Server_ClientIP($hSocket)
; Parameters ....: $hSocket - Client socket handle.
; Return values .: A string with the IP address.
; Author ........: Unknown
; Modified.......: Kip
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......;
;
; ;==========================================================================================

Func _TCP_Server_ClientIP($hSocket)

Local $pSocketAddress, $aReturn

$pSocketAddress = DllStructCreate("short;ushort;uint;char[8]")
$aReturn = DllCall("Ws2_32.dll", "int", "getpeername", "int", $hSocket, "ptr", DllStructGetPtr($pSocketAddress), "int*", DllStructGetSize($pSocketAddress))
If @error Or $aReturn[0] <> 0 Then Return 0

$aReturn = DllCall("Ws2_32.dll", "str", "inet_ntoa", "int", DllStructGetData($pSocketAddress, 3))
If @error Then Return 0

$pSocketAddress = 0

Return $aReturn[0]

EndFunc





; #FUNCTION# ;===============================================================================
;
; Name...........: _TCP_Send
; Description ...: Sends data to a server or client.
; Syntax.........: _TCP_Send($hSocket, $sText)
; Parameters ....: $hSocket - Client or server socket handle.
; $sText - Data to send.
; Return values .:
; Author ........: Kip
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......;
;
; ;==========================================================================================

Func _TCP_Send($hSocket, $sText)

Return TCPSend($hSocket, $sText)

EndFunc



Func ___TCP_Client_OnSocketEvent( $hWnd, $iMsgID, $WParam, $LParam )

Local $iError = ___HiWord( $LParam )
Local $iEvent = ___LoWord( $LParam )

Local $hSocket, $iElement, $i, $sDataBuff

Abs($hWnd)
Abs($WParam)

$hSocket = 0
$iElement = 0

For $i = 1 to UBound($__TCP_SOCKETS)-1

If $__TCP_SOCKETS[$i][1] = $iMsgID Then
$hSocket = $__TCP_SOCKETS[$i][0]
$iElement = $i
ExitLoop
EndIf

Next

If $hSocket Then

Switch $iEvent
Case $FD_READ; Data has arrived!

$sDataBuff = TCPRecv( $hSocket, 1024)

Call($__TCP_SOCKETS[$i][2], $hSocket, $sDataBuff, $iError)

$sDataBuff = ""

Case $FD_WRITE

Call($__TCP_SOCKETS[$i][3], $hSocket, $iError)

Case $FD_CONNECT

Call($__TCP_SOCKETS[$i][4], $hSocket, $iError)

Case $FD_CLOSE

___ASockShutdown( $hSocket )
TCPCloseSocket( $hSocket )

Call($__TCP_SOCKETS[$i][5], $hSocket, $iError)

___ArrayDelete($__TCP_SOCKETS, $iElement)

EndSwitch

EndIf

EndFunc



;==================================================================================================================
;
; Zatorg's Asynchronous Sockets UDF Starts from here.
;
;==================================================================================================================


Func ___ASocket($iAddressFamily = 2, $iType = 1, $iProtocol = 6)
If $hWs2_32 = -1 Then $hWs2_32 = DllOpen( "Ws2_32.dll" )
Local $hSocket = DllCall($hWs2_32, "uint", "socket", "int", $iAddressFamily, "int", $iType, "int", $iProtocol)
If @error Then
SetError(1, @error)
Return -1
EndIf
If $hSocket[ 0 ] = -1 Then
SetError(2, ___WSAGetLastError())
Return -1
EndIf
Return $hSocket[ 0 ]
EndFunc ;==>_ASocket

Func ___ASockShutdown($hSocket)
If $hWs2_32 = -1 Then $hWs2_32 = DllOpen( "Ws2_32.dll" )
Local $iRet = DllCall($hWs2_32, "int", "shutdown", "uint", $hSocket, "int", 2)
If @error Then
SetError(1, @error)
Return False
EndIf
If $iRet[ 0 ] <> 0 Then
SetError(2, ___WSAGetLastError())
Return False
EndIf
Return True
EndFunc ;==>_ASockShutdown

Func ___ASockClose($hSocket)
If $hWs2_32 = -1 Then $hWs2_32 = DllOpen( "Ws2_32.dll" )
Local $iRet = DllCall($hWs2_32, "int", "closesocket", "uint", $hSocket)
If @error Then
SetError(1, @error)
Return False
EndIf
If $iRet[ 0 ] <> 0 Then
SetError(2, ___WSAGetLastError())
Return False
EndIf
Return True
EndFunc ;==>_ASockClose

Func ___ASockSelect($hSocket, $hWnd, $uiMsg, $iEvent)
If $hWs2_32 = -1 Then $hWs2_32 = DllOpen( "Ws2_32.dll" )
Local $iRet = DllCall( _
$hWs2_32, _
"int", "WSAAsyncSelect", _
"uint", $hSocket, _
"hwnd", $hWnd, _
"uint", $uiMsg, _
"int", $iEvent _
)
If @error Then
SetError(1, @error)
Return False
EndIf
If $iRet[ 0 ] <> 0 Then
SetError(2, ___WSAGetLastError())
Return False
EndIf
Return True
EndFunc ;==>_ASockSelect

; Note: you can see that $iMaxPending is set to 5 by default.
; IT DOES NOT MEAN THAT DEFAULT = 5 PENDING CONNECTIONS
; 5 == SOMAXCONN, so don't worry be happy
Func ___ASockListen($hSocket, $sIP, $uiPort, $iMaxPending = 5); 5 == SOMAXCONN => No need to change it.
Local $iRet
Local $stAddress

If $hWs2_32 = -1 Then $hWs2_32 = DllOpen( "Ws2_32.dll" )

$stAddress = ___SockAddr($sIP, $uiPort)
If @error Then
SetError(@error, @extended)
Return False
EndIf

$iRet = DllCall($hWs2_32, "int", "bind", "uint", $hSocket, "ptr", DllStructGetPtr($stAddress), "int", DllStructGetSize($stAddress))
If @error Then
SetError(3, @error)
Return False
EndIf
If $iRet[ 0 ] <> 0 Then
$stAddress = 0; Deallocate
SetError(4, ___WSAGetLastError())
Return False
EndIf

$iRet = DllCall($hWs2_32, "int", "listen", "uint", $hSocket, "int", $iMaxPending)
If @error Then
SetError(5, @error)
Return False
EndIf
If $iRet[ 0 ] <> 0 Then
$stAddress = 0; Deallocate
SetError(6, ___WSAGetLastError())
Return False
EndIf

Return True
EndFunc ;==>_ASockListen

Func ___ASockConnect($hSocket, $sIP, $uiPort)
Local $iRet
Local $stAddress

If $hWs2_32 = -1 Then $hWs2_32 = DllOpen( "Ws2_32.dll" )

$stAddress = ___SockAddr($sIP, $uiPort)
If @error Then
SetError(@error, @extended)
Return False
EndIf

$iRet = DllCall($hWs2_32, "int", "connect", "uint", $hSocket, "ptr", DllStructGetPtr($stAddress), "int", DllStructGetSize($stAddress))
If @error Then
SetError(3, @error)
Return False
EndIf

$iRet = ___WSAGetLastError()
If $iRet = 10035 Then; WSAEWOULDBLOCK
Return True; Asynchronous connect attempt has been started.
EndIf
SetExtended(1); Connected immediately
Return True
EndFunc ;==>_ASockConnect

; A wrapper function to ease all the pain in creating and filling the sockaddr struct
Func ___SockAddr($sIP, $iPort, $iAddressFamily = 2)
Local $iRet
Local $stAddress

If $hWs2_32 = -1 Then $hWs2_32 = DllOpen( "Ws2_32.dll" )

$stAddress = DllStructCreate("short; ushort; uint; char[8]")
If @error Then
SetError(1, @error)
Return False
EndIf

DllStructSetData($stAddress, 1, $iAddressFamily)
$iRet = DllCall($hWs2_32, "ushort", "htons", "ushort", $iPort)
DllStructSetData($stAddress, 2, $iRet[ 0 ])
$iRet = DllCall($hWs2_32, "uint", "inet_addr", "str", $sIP)
If $iRet[ 0 ] = 0xffffffff Then; INADDR_NONE
$stAddress = 0; Deallocate
SetError(2, ___WSAGetLastError())
Return False
EndIf
DllStructSetData($stAddress, 3, $iRet[ 0 ])

Return $stAddress
EndFunc ;==>__SockAddr

Func ___WSAGetLastError()
If $hWs2_32 = -1 Then $hWs2_32 = DllOpen( "Ws2_32.dll" )
Local $iRet = DllCall($hWs2_32, "int", "WSAGetLastError")
If @error Then
;ConsoleWrite("+> _WSAGetLastError(): WSAGetLastError() failed. Script line number: " & @ScriptLineNumber & @CRLF)
SetExtended(1)
Return 0
EndIf
Return $iRet[ 0 ]
EndFunc ;==>_WSAGetLastError


; Got these here:
; www.autoitscript.com/forum/index.ph...620&hl=MAKELONG
Func ___MakeLong($LoWord, $HiWord)
Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF)); Thanks Larry
EndFunc ;==>_MakeLong

Func ___HiWord($Long)
Return BitShift($Long, 16); Thanks Valik
EndFunc ;==>_HiWord

Func ___LoWord($Long)
Return BitAND($Long, 0xFFFF); Thanks Valik
EndFunc ;==>_LoWord


; ========================================= Array functions

; #FUNCTION# ====================================================================================================================
; Name...........: _ArrayDelete
; Description ...: Deletes the specified element from the given array.
; Syntax.........: _ArrayDelete(ByRef $avArray, $iElement)
; Parameters ....: $avArray - Array to modify
; $iElement - Element to delete
; Return values .: Success - New size of the array
; Failure - 0, sets @error to:
; |1 - $avArray is not an array
; |3 - $avArray has too many dimensions (only up to 2D supported)
; |(2 - Deprecated error code)
; Author ........: Cephas <cephas at clergy dot net>
; Modified.......: Jos van der Zande <jdeb at autoitscript dot com> - array passed ByRef, Ultima - 2D arrays supported, reworked function (no longer needs temporary array; faster when deleting from end)
; Remarks .......: If the array has one element left (or one row for 2D arrays), it will be set to "" after _ArrayDelete() is used on it.
; Related .......: _ArrayAdd, _ArrayInsert, _ArrayPop, _ArrayPush
; Link ..........;
; Example .......; Yes
; ===============================================================================================================================
Func ___ArrayDelete(ByRef $avArray, $iElement)
If Not IsArray($avArray) Then Return SetError(1, 0, 0)

Local $iUBound = UBound($avArray, 1) - 1

If Not $iUBound Then
$avArray = ""
Return 0
EndIf

; Bounds checking
If $iElement < 0 Then $iElement = 0
If $iElement > $iUBound Then $iElement = $iUBound

; Move items after $iElement up by 1
Switch UBound($avArray, 0)
Case 1
For $i = $iElement To $iUBound - 1
$avArray[$i] = $avArray[$i + 1]
Next
ReDim $avArray[$iUBound]
Case 2
Local $iSubMax = UBound($avArray, 2) - 1
For $i = $iElement To $iUBound - 1
For $j = 0 To $iSubMax
$avArray[$i][$j] = $avArray[$i + 1][$j]
Next
Next
ReDim $avArray[$iUBound][$iSubMax + 1]
Case Else
Return SetError(3, 0, 0)
EndSwitch

Return $iUBound
EndFunc ;==>_ArrayDelete


Grazie anticipate a tutti!

Edited by I.Ren - 8/1/2011, 12:19
 
Top
Cale92
CAT_IMG Posted on 8/1/2011, 00:35     +1   -1




ora sono dal cel e non posso vedere però come progetto mi pare molto bello.. se si riuscisse a fare un cosa del genere in streaming sarebbe fantastico ( magari lo e gia non so) domani ci guardo.. bravo..
 
Top
I.Ren
CAT_IMG Posted on 8/1/2011, 12:00     +1   -1




Sisi funzia in streaming l'ascoltare.
 
Top
Cale92
CAT_IMG Posted on 8/1/2011, 12:34     +1   -1




@I.Ren i source dei client non coincidono... non mi pare che ci siano virus ma stai attento... ora sto controllando un po'..
 
Top
/dev/random
CAT_IMG Posted on 8/1/2011, 12:37     +1   -1




FTP? Con FTP si può fare streaming, scaricare e caricare. E si può fare tutto insieme.
 
Top
FrontBack
CAT_IMG Posted on 8/1/2011, 12:44     +1   -1




pulito
 
Top
I.Ren
CAT_IMG Posted on 8/1/2011, 12:52     +1   -1




probabilmente mi sono dimenticato di compilare il client <.< il server lo compilavo sempre per provare e poi facevo partire il client direttamente dalla scite <.<

CITAZIONE (/dev/random @ 8/1/2011, 12:37) 
FTP? Con FTP si può fare streaming, scaricare e caricare. E si può fare tutto insieme.

Streaming con ftp?
 
Top
/dev/random
CAT_IMG Posted on 8/1/2011, 13:15     +1   -1




Si, richiedi il file e mano mano che ti arriva lo riproduci. Certo, con la UDF di AutoIT però non vai lontano, devi reimplementare tutto.
 
Top
I.Ren
CAT_IMG Posted on 8/1/2011, 13:27     +1   -1




mh buona idea, poi provo!
 
Top
I.Ren
CAT_IMG Posted on 8/1/2011, 17:13     +1   -1




Cale l'hai provato? come ti sembra?

e gli altri? u.u
 
Top
Aaly
CAT_IMG Posted on 8/1/2011, 18:52     +1   -1




Sembra un bel progetto, più tardi lo provo che ora ho da fare =)
 
Top
xMasteRx
CAT_IMG Posted on 8/1/2011, 20:07     +1   -1




sembra buono a vedere del source ^^
magari più tardi lo provo
 
Top
I.Ren
CAT_IMG Posted on 8/1/2011, 20:08     +1   -1




No il source è davvero pessimo xD

Cmq ok, provatelo a sappiatemi dire u.u

Grazie mille a tutti!
 
Top
xMasteRx
CAT_IMG Posted on 8/1/2011, 20:26     +1   -1




ma io personalmente non giudico se il tuo script presenta errori o altro, io giudico dall'idea e dal come provi a metterla nel foglio ^^
 
Top
I.Ren
CAT_IMG Posted on 8/1/2011, 21:01     +1   -1




ah ok xD
 
Top
29 replies since 8/1/2011, 00:18   608 views
  Share