Jump to content

Need help


Demon777
 Share

Recommended Posts

Hello all.

I need help again... Today its a Network. I wanna make program that connecting to Server per Network (Lan). But i need to know how to make this program to read IP what i tuped in InputBox on my Form. I wanna do so : Program should Read IP that was typed in Inputbox and connect to it. + Should i use TCPConnect functions ? plz help

Thx

Link to comment
Share on other sites

Ok thx... But i have another problemm with it...

For exampel : This is simple server that i took in post where its all about.

But i dont need any natifications that Data arrived and so on.... I wanna make it just to become commands and server should make them.... I need no GUI and so on just commands... I thinked about that Client will send 'CD' command for exampel and when Server will become this command it ll open CD-ROM....

So >>>??? Any Ideas ????

BTW. I dont realy know how to modify this simple server :) So plz help :|

It should just recive commands that i sending and make them... No GUI, No TrayIcon... ^_^

#include <ASock.au3>
Const $MYMSG = 1024

;;;
Const $PORT2LISTEN = 42775
;;;

Global $hNotifyGUI = GUICreate( "notify" )
Global $hListen
Global $hAccepted = -1
If Not TCPStartup( ) Then Exit 1
If Not _StartServer( "0.0.0.0", $PORT2LISTEN, "OnEvent" ) Then Exit 2
ConsoleWrite( "+> Waiting for connection on port #" & $PORT2LISTEN & "..." & @CRLF )
While $hAccepted = -1; You can alse use a flag like $bConnected which would be changed by OnAccept()
                ; when a connection is accepted...
  ; blah blah...
WEnd
; Connection accepted!
ConsoleWrite( "Connection accepted, socket #" & $hAccepted & @CRLF )

While $hAccepted <> -1; While still connected
  ; Do whatever you like here.
  ; Do GUI handling etc.
WEnd
TCPCloseSocket( $hListen )
TCPShutdown( )
Exit 0

; This is called when an event has happened on a socket.
Func OnEvent( $hWnd, $iMsgID, $WParam, $LParam )
    Local $hSocket = $WParam; Get the socket involved (either $hListen or $hAccepted in this example)
    Local $iError = _HiWord( $LParam ); If error is 0 then the event indicates about a success
    Local $iEvent = _LoWord( $LParam ); The event: incoming conn / data received / perfect conditions to send / conn closed
   
    Local $sDataBuff
   
    If $iMsgID = $MYMSG Then; Winsock, not Windows GDI
        Switch $iEvent
            Case $FD_ACCEPT; Incoming connection!
                If $iError <> 0 Then
                    Exit MsgBox( 16, "simpleServer error", "Failed to listen to " & $PORT2LISTEN & "." )
                EndIf
                $hAccepted = TCPAccept( $hListen )
            Case $FD_READ; Data has arrived!
                If $iError <> 0 Then
                    TCPCloseSocket( $hAccepted )
                    $hAccepted = -1
                Else
                    $sDataBuff = TCPRecv( $hAccepted, 8192 )
                    If @error Then
                        TCPCloseSocket( $hAccepted )
                        $hAccepted = -1
                    Else
                        ConsoleWrite( "{{" & $sDataBuff & "}}" & @CRLF )
                        TrayTip( "Data has arrived!", $sDataBuff, 30 )
                    EndIf
                EndIf
            Case $FD_WRITE
                If $iError <> 0 Then
                    TCPCloseSocket( $hAccepted )
                    $hAccepted = -1
                EndIf
            Case $FD_CLOSE; Bye bye
                _ASockShutdown( $hAccepted ); Graceful shutdown.
                Sleep( 1 )
                TCPCloseSocket( $hAccepted )
                $hAccepted = -1
        EndSwitch
    EndIf
EndFunc

Func _StartServer( $sIP, $iPort, $sFunc )
    $hListen = _ASocket( )
    If @error Then Return False
    _ASockSelect( $hListen, $hNotifyGUI, $MYMSG, BitOR( $FD_ACCEPT, $FD_READ, $FD_WRITE, $FD_CLOSE ) )
    If @error Then Return False
    GUIRegisterMsg( $MYMSG, $sFunc )
    _ASockListen( $hListen, $sIP, $iPort )
    If @error Then Return False
    Return True
EndFunc

Thx...

Edited by Demon777
Link to comment
Share on other sites

Ok thx... But i have another problemm with it...

For exampel : This is simple server that i took in post where its all about.

But i dont need any natifications that Data arrived and so on.... I wanna make it just to become commands and server should make them.... I need no GUI and so on just commands... I thinked about that Client will send 'CD' command for exampel and when Server will become this command it ll open CD-ROM....

So >>>??? Any Ideas ????

BTW. I dont realy know how to modify this simple server :) So plz help :|

It should just recive commands that i sending and make them... No GUI, No TrayIcon... ^_^

[i've had a little interest in the past in the script I pointed out. I will see if next week I can work something up in it. -maybe label it so you can delete what ever you want . . .

btw -it soulds like you are writing something from 99 thats be classified as a malware. - if your final request seems to be something like this, then I doubt anyone will help you. That does nothing but hurt autoit and I like it to much to get classified as malware in general.

Edited by Hatcheda
Link to comment
Share on other sites

Its not a malware.... Just a useful programm that i will use on my PC to send files to my another pc and so on... Becouse my LAN dont work correctly (Lan Cable)

So its a point to use it coz i have also Router so.... I can enter another PC's IP and send file that i want.... Or download from my another PC back....

U wanna know why i am not using Total Commander or so ??? Easy answer : My Router !!! :) So dont afraid that i am making bad things

Link to comment
Share on other sites

1. wrong answer buddy, if it is the router then you could work out the following.

Router settings:

Applications (router specific wording)

Port Range Forward

make up an application name

use the port of the application for start end

give the ip address of the computer you wish to work with.

done.

2. If its really the router, than anything anyone builds will have the same firewall problem. since they all use ports.

3. they are both your computers, right? you have the passwords, right? -FlashFXP- free trial for a month. you can look at the other computer without popups

to me it sounds like you want to do stuff on the other pc with out any form of notification. what I hear you saying is you want to sneak. if you have the passwords then perhaps you are allowe to sneak, in which case an ftp client would work for you.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...