Results 1 to 19 of 19

Thread: Bigest Winsock Problem

  1. #1

    Thread Starter
    Lively Member Dominator's Avatar
    Join Date
    Oct 2004
    Location
    Egypt
    Posts
    65

    Bigest Winsock Problem

    For my previous post of "Logical Problem" I want to make an array of winsock and alexreg help me out, and i solve it, but the problem are still, What is my problem ? (Winsock Connections)

    I working on Network Application (Server/Client) There are one server and say 250 clients, Application for net cafe..

    The server are controlling those 250 clients, Here are some function of my app, For examble
    [Disable Start menu], [Disable Taskbar], [Shutdwon]

    If i need to execute this function, i have to send an command to the client to execute it, So I must connect to this clients first, For examble

    WSD.Close
    WSD.Connect Client_IP, Client_Port "Error Cause"
    WSD.Senddata ("Shutdwon") "Error appera hear"

    With the above code i will Close the connection with any previous clients and reconnect to the selected IP And Port and then send the command that is shutdwon the clients computer.

    Say with me, if the admin want to Shut down all the clients at once, ( the 250 Clints at one time).
    Then i need to array of 250 Object of winsock (Its ok i make it).

    MY Big Brpblem Is When I Connect To The Clients..
    1- Close Connection
    2- Establish Connection "Error are here cause its may not connected"
    3- Send Command "Error are appear hear cause i send data to closed chanel"

    the step establish a connection , may take some time may be 2 second may be 1 second and may be not connected yet...


    Even if i tryed the state of winsock (For examble)
    {
    WSD.Close
    WSD.Connect Client_IP, Client_Port "Error Cause"
    Do while WSD.state <> sckConnected
    doevents
    Loop
    ------>> The above loop may take 1 second and may take a minutes and in other time not finished yet
    ------>> In some times its loop for infinty, and the next code line never execute cause its not connected..
    WSD.Senddata ("Shutdwon") "Error appera hear"
    }

    I need a strategies to controll an multible winsock [and i need a solution to handel the connections delay]
    I need a good algorthim..

    Hope that any body understand my problem, And PLEASE RESPONSE FAST...
    Thanks for whatever help...

    What i need i need to mointor all the client on my screen and send one command to all the client at once..

    I NEED A CODE THAT CONNECT TO ALL THE CLIENTS WITHOUT ANY UNCONNECTED CLIENTS
    .........................................................
    John F. Gouda {A.K.A}{Dominator Legend}
    Software Engineer
    +20-0125113313
    .......................................................
    Please feel free to download my projects:
    Http://DominatorLegend.Co.Nr
    .................................................................................................... ................................................................................................
    Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...

  2. #2
    Member
    Join Date
    Apr 2004
    Location
    Millbrae, CA
    Posts
    48
    Huh?

    And you're loop will never execute if the winsock is connected.

  3. #3

    Thread Starter
    Lively Member Dominator's Avatar
    Join Date
    Oct 2004
    Location
    Egypt
    Posts
    65

    Unhappy What Is Funy

    What is funy..

    i have a 200 client i need to connect to each one of them and send to him a command..

    Did any body have an Code that help to connect to each client of the 200 client and send to him his command without any unconnected clients (I mean client connected is 100%)

    Please any help will be greatfull,,

    Please help my my project is stoped now, So please help me fast.

    thanks for whatever help
    .........................................................
    John F. Gouda {A.K.A}{Dominator Legend}
    Software Engineer
    +20-0125113313
    .......................................................
    Please feel free to download my projects:
    Http://DominatorLegend.Co.Nr
    .................................................................................................... ................................................................................................
    Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...

  4. #4
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959
    Can you post your project, or some more code, the connection code and the data sending part. Also use code codes.

  5. #5

    Thread Starter
    Lively Member Dominator's Avatar
    Join Date
    Oct 2004
    Location
    Egypt
    Posts
    65

    Angry PLease HElp

    Here is my project its big and very powerfull but if its complete please help me to complete it

    PLEASE I NEED HELP, The problem is when i send a command to a multi clients, some client connected and some other not connected, HERE IS THE PROJECT ANALYSE IT AND THEN HELP ME, PLEASE

    PLEASE ANY HELP
    Last edited by Dominator; Oct 8th, 2004 at 06:34 AM.
    .........................................................
    John F. Gouda {A.K.A}{Dominator Legend}
    Software Engineer
    +20-0125113313
    .......................................................
    Please feel free to download my projects:
    Http://DominatorLegend.Co.Nr
    .................................................................................................... ................................................................................................
    Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...

  6. #6
    Member 0pal_t0ad's Avatar
    Join Date
    Oct 2003
    Location
    Southampton,UK
    Posts
    63
    i have not downloaded your projet yet, but from what i read about it, you are going about it the wrong way. The point of a server is for the clients to connect to it! not the other way round.

    In your case, once the client has connected to the server, it must not disconnect, only the server should be able to do that.

    P.S: I'll try take a look at your project later on.
    When i write my code, there are only 2 ppl that understand it, me and God... a week later... God only knows
    (can't remember where i heard/read that)

  7. #7

    Thread Starter
    Lively Member Dominator's Avatar
    Join Date
    Oct 2004
    Location
    Egypt
    Posts
    65
    I change the Attachment file because old one is broken,

    I'm not going to the rong way,

    the client have to connect to the server, and add its details on listview.

    About ur qustion that that must not disconnect, say with if the admin want to restart his computer or its computer is hang up, then, i must put into my mind this possible, so i make the client connect to the server ever 1 second if the server is go away,

    i have to set the posible to disconnect the server from client, please download the project, its chance..

    PLEASE DOWNLOAD AND HELP ME OUT...
    Attached Files Attached Files
    .........................................................
    John F. Gouda {A.K.A}{Dominator Legend}
    Software Engineer
    +20-0125113313
    .......................................................
    Please feel free to download my projects:
    Http://DominatorLegend.Co.Nr
    .................................................................................................... ................................................................................................
    Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...

  8. #8
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959
    VB Code:
    1. Private Sub Winsock1_Connect(Index As Integer)
    2. Winsock1(Index).SendData "Shutdown"
    3. End Sub

    ??

  9. #9
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    just have the client check the connection every minute, and reconnect when the connection is lost.

  10. #10
    Hyperactive Member
    Join Date
    Apr 2004
    Location
    Philippines
    Posts
    285
    once a client conects to the server, you need to instantiate or load a new winsock control to acccept that connection. therefore, if you have 200 clients, you will have an array of 200 winsock controls in your server + 1 winsock control that listens for connections. to send a command to each client, you don't need to reconnect to each client. just iterate through your array of winsock controls in the server and send command to clients.

  11. #11

    Thread Starter
    Lively Member Dominator's Avatar
    Join Date
    Oct 2004
    Location
    Egypt
    Posts
    65

    Angry Please Help

    Please i need the structure, imean i need an project, or examble in a zip file to see it, cause i confused and i don't know how to start building this structure, so i need a full examble of how to send command and recive it, and i want when the client connect to me, to add its info to a list view, I Need a structure or examble of client and server,

    Please any body help me and build it for me, Please any help on this cause my project stop.
    .........................................................
    John F. Gouda {A.K.A}{Dominator Legend}
    Software Engineer
    +20-0125113313
    .......................................................
    Please feel free to download my projects:
    Http://DominatorLegend.Co.Nr
    .................................................................................................... ................................................................................................
    Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...

  12. #12
    Lively Member
    Join Date
    Nov 2002
    Location
    Delaware
    Posts
    126

    Sounds like a database app to me. . .

    @ client startup runs app that connects to server and reports it IP, signon user, machine name, etc that's stored in db (access, or csv, or whatever)

    Server App looks at db to see clients.

    When client signs off deletes record off db (or better still records a signoff in db to provide auditing)

    Depending on OS you could even shell the shutdown commands to each pc using machine name.


    Or am I oversimplifing a complicated problem?
    Dave

    [vbcode]

    Dim ScrewingAround as cIncessant.Need

    Set ScrewingAround = New cIncessant.Need

    If atWork = True then
    Call ScrewingAround.begin
    Else
    Call ScrewingAround.begin
    End If

    [/vbcode]

  13. #13
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    When connecting with a winsock array, dont forget to set local port to 0 so you automatially search for an available port.

    Here, read this.
    Attached Files Attached Files

  14. #14

    Thread Starter
    Lively Member Dominator's Avatar
    Join Date
    Oct 2004
    Location
    Egypt
    Posts
    65

    Angry All I Can Say After That

    Please I need a vb project in a .zip file, to specify the solution of my problem.. I know that my request may be little hard but please i need help from any body,
    i need a vb project in zip file that contain the following options.

    A PROBLEM SPICIFICATION

    [a] a server side.
    --------------------------------------------------------------------------
    [1] ability to connect to multible user
    [2] ability to send a command to multible user
    [3] ability to send a file to multible user.
    [4] ability to add the client information in a list view (status,ip,machine name, time, etc ) when the client connect to server
    [5] when the client is diconnect from server (for any reason), don't remove client data from the list view but, we mark it as unreachable client
    [6] the ability to find the client again and add them to list view, if the server has been closed or restarted.

    [b] a Client side.
    --------------------------------------------------------------------------
    [1] the ability to send command to server
    [2] the ability to send a file to the server.
    [3] when the client is disconnect don't remove its info from list view but we mark it as unreachable user.
    [4] is the server has been shutdown or restarted we must have the ability to connect to it again, i mean reconnect to it in case its closed.

    I think with spicification of the problem, that every body understand the problem, and ready to help me if he can,
    if any body don't under stand the problem pleas download attachment. The Attachment Project

    And im realy thanks for what ever help from any body, and please agin i need a vb project in a zip file that include the above option,

    And thanks agin for whatever help...
    .........................................................
    John F. Gouda {A.K.A}{Dominator Legend}
    Software Engineer
    +20-0125113313
    .......................................................
    Please feel free to download my projects:
    Http://DominatorLegend.Co.Nr
    .................................................................................................... ................................................................................................
    Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...

  15. #15
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: Please Help

    Originally posted by Dominator
    ...and i want when the client connect to me, to add its info to a list view,
    As is the only infp you'll get are the .REMOTE____ properties. Any other info you'll have to make the remotehost send them over.

  16. #16
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: All I Can Say After That

    [a] a server side.
    --------------------------------------------------------------------------
    [1] ability to connect to multible user
    - Use a winsock control array, index = 0 listens only. Create an additional instance on connecton request and have the new instance accept the request using requestID as reference.

    [2] ability to send a command to multible user
    - Use the connection in the previous step.

    [3] ability to send a file to multible user.
    - I suggest you use another winsock control array, the previous control array would be limited to sending 'commands'. Since the second winsock array will have a different DataArrival algorithm as opposed to the winsock array for sending/receiving commands.

    [4] ability to add the client information in a list view (status,ip,machine name, time, etc ) when the client connect to server
    on Connect() event (for connecting host) and connection request event (for accepting host)
    .State - after accepting
    .RemoteHostIP - after accpeting
    .RemoteHost - after accepting
    Now
    all other info you might need to send over as I previously mentioned in another post

    [5] when the client is diconnect from server (for any reason), don't remove client data from the list view but, we mark it as unreachable client
    on close event read the state
    unreachable should only be determined on error event, sckNetworkUnreachable

    [6] the ability to find the client again and add them to list view, if the server has been closed or restarted.
    - on run time store the IP addresses no duplicates, upon app start read through this text file and attempt to reconnect to the IP addresses. Or use the registry instead using the IP address as the registry key

    [b] a Client side.
    --------------------------------------------------------------------------
    [1] the ability to send command to server
    - do only when the command sending winsock is connected

    [2] the ability to send a file to the server.
    - use another winsock array similar to that of the server

    [3] when the client is disconnect don't remove its info from list view but we mark it as unreachable user.
    - this implementation should be at the server as previously explained. A modification would be to have the clients attempt to connect to the server using a timer. They store the last IP address used by the server in file or registry. Additional commands will have to be sent to identify the remotehost as the server upon connection.

    [4] is the server has been shutdown or restarted we must have the ability to connect to it again, i mean reconnect to it in case its closed.
    - previously explained. You can't have both hosts attempting to reinitiate the connection. Its like opening a can of worms.

  17. #17

    Thread Starter
    Lively Member Dominator's Avatar
    Join Date
    Oct 2004
    Location
    Egypt
    Posts
    65

    Thumbs up Thats Nice Solution

    Can you please transform these answers into vb code, i mean a vb project included in a zip file, i need a code and a project, i already know this solution but i can't make it as code, please code it for me, and upload it, and thanks for whatever help, please make it a project in a zip file
    .........................................................
    John F. Gouda {A.K.A}{Dominator Legend}
    Software Engineer
    +20-0125113313
    .......................................................
    Please feel free to download my projects:
    Http://DominatorLegend.Co.Nr
    .................................................................................................... ................................................................................................
    Direct Library | Speech Library | System Locker V.3 | Magic Encryptor | And many many more, follow the link above...

  18. #18
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    Sorry I dont have a sample handy and I wont be able to make one for you cause of my sked.

    An additional tip though for the commands, define a header-value design, say 15 characters for header, char 16 onwards if existing is the value for the command.

    eg.
    Dim Const constCOMM_USERINFO = "CM_USERINFO "
    Dim Const constCOMMLENGTH = 15
    strPacket = "CM_USERINFO LogInName_NotHostName"

    So on data arrival at command line you divide the string into 15 and all the rest. You then

    Select Case Left(strDataIn, constCOMMLENGTH)
    Case constCOMM_USERINFO

    Case another command
    End Select

    etc

    And errros from typo on SendData, DataArrival is minimized
    Last edited by leinad31; Oct 15th, 2004 at 02:43 PM.

  19. #19
    Hyperactive Member
    Join Date
    Apr 2004
    Location
    Philippines
    Posts
    285
    here's a little something i made. i think you can find some ideas from this sample i didn't include sending files in this sample program. hope you could get something from this this is just a very simple program that simulates the environment you want. i made this for just an hour
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width