Page 2 of 2 FirstFirst 12
Results 41 to 63 of 63

Thread: Type Mismatch

  1. #41
    Addicted Member
    Join Date
    Jul 2006
    Posts
    147

    Re: Type Mismatch

    Where/how did you make servicesocket and what exactly does it contain?

  2. #42

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    158

    Re: Type Mismatch

    i have no idea...this isnt really my code, im just trying to make it all work, and if i knew VB enough i wouldnt be on the forums

  3. #43
    Addicted Member
    Join Date
    Jul 2006
    Posts
    147

    Re: Type Mismatch

    so servicesocket is a vb thingy? meh im stuck with 2005 only where i am atm
    post all the server code for the hell of it

  4. #44

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    158

    Re: Type Mismatch

    Well code is too long to post so its here well actually thats the whole project, might be a lil messy..(sry)hope u can see whats going on, cuz for sum reason i cant

  5. #45
    Addicted Member
    Join Date
    Jul 2006
    Posts
    147

    Post Re: Type Mismatch

    cant do much till him home, vb6 there not darn 2005

    prety much all i can offer is to test to find out where it gets, theres always the debug stuff, i just like msgboxs:P

    what does a msgbox here display?
    (be warned that msgboxs inside big loops are a bad bad idea they dont like to go away till the loops fiinishd, thus the exit function or whatever works)

    VB Code:
    1. [B]msgbox ServiceSocket.UBound[/B]
    2. For i = 1 To ServiceSocket.UBound
    3.   [B]msgbox i & " " & servicesocket(i)[/B]
    4.  
    5.   testing = ServiceSocket(i).Index
    6.  
    7.   If ServiceSocket(i).Index = rs.Fields("oindex") Then
    8.      If ServiceSocket(i).State = sckConnected Then
    9.         ServiceSocket(i).SendData ".statusUpdate 1" & " " & user & " " & status 'send status of user to its buddies if their online
    10.      End If
    11.   End If
    12. [B]  EXIT FUNCTION[/B]
    13. Next i

  6. #46

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    158

    Re: Type Mismatch

    when i run the project with that code, i get no msgboxes when anyone signs on, then when sumone signs off i get the first msgbox i get is "5" then after i click ok i get another msgbox saying "1" then i click ok and thats it

  7. #47
    Addicted Member
    Join Date
    Jul 2006
    Posts
    147

    Re: Type Mismatch

    VB Code:
    1. rs.Open "SELECT buddy, oindex FROM buddies, online WHERE buddies.buddy = '" + _
    2.                     CStr(user) + "' AND buddies.user = online.username", conn
    3.         While rs.EOF = False
    while they login they wouldnt be in the online table? which means the rowset could be empty? just under that do a msgbox of a rowcount(recordcount/whatever) on that rowset, see what it turns up

    edited some bad typing out

  8. #48

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    158

    Re: Type Mismatch

    well i actually looked at the database while i was signed on, and it shows that im online and it shows that anyone else is also online, so i know that it updates the DB with the whos online or not, it just doesnt get sent to the clients to let them know whos on or whos not

  9. #49
    Addicted Member
    Join Date
    Jul 2006
    Posts
    147

    Re: Type Mismatch

    um
    VB Code:
    1. ElseIf Word(strIncoming, 1) = ".updateStatus" Then 'Updates User status: online, away, etc
    2.           Call update_status(Word(strIncoming, 2), Word(strIncoming, 3), Index)
    works fine for me where you had the problem before.. using val seems to stuff it for me though

    Edit: ok well that did nothing.. sigh still working on it
    Last edited by Ishamael; Aug 31st, 2006 at 06:43 AM.

  10. #50
    Addicted Member
    Join Date
    Jul 2006
    Posts
    147

    Re: Type Mismatch

    Thats it, the lot of you get out of chit chat and figure this out

    this code is ment to update the buddy list of all users currently on the server...
    and should i put a msgbox anywhere in there it will go off it does just that..
    However.. without the msgbox it fails to update existing clients, and i am to tired to know why.

    i cant work on this for another 18 hours or so after this post. sleep then work.

    the status is either 1 or 0, user on or off, user is the username, and index is there index.. socketindex i guess(its my first day on sockets lay off the nasty comments :P)

    now all vairables appear to be right, the right info seems to come into the function, it just fails to work 100% unless it has a msgbox in there to go off. and less you have a pet monkey or mendhak i can leave at the server clicking msgbox's away it wont work

    i dont really care if you dont code it for me just puzzled on the msgbox thing.. i guessed it might need some time so i set up a tmr enable, while timer endabled doevents loop, with the tmr turning itself off.. didnt work.
    im stumped, and tired, nite guys, thanks if you can figure it, have a good day over there

    and no i didnt write it all, most i got from chris who seems to have gotten it from someone else.. which one of you decided to play a prank on the newbies and give them broken code..

    VB Code:
    1. Private Function update_status(status As Integer, user As String, index As integer)
    2.  
    3. Dim rs As New ADODB.Recordset
    4. Dim rs2 As New ADODB.Recordset
    5. Dim conn As New ADODB.Connection
    6. Dim Counter As Integer
    7. conn.Open sConnString
    8.  
    9. If ServiceSocket(index).State = sckConnected Then
    10.     rs2.Open "UPDATE online SET ostatus = " & CStr(status) & " WHERE username = '" + _
    11.     CStr(user) + "' AND oindex = " & CStr(index), conn
    12. End If
    13.    
    14. 'Gets the ppl that have user as buddies that are currently online
    15.  
    16. rs.Open "SELECT buddy, oindex FROM buddies, online WHERE buddies.buddy = '" + _
    17. CStr(user) + "' AND buddies.user = online.username", conn
    18.  
    19. 'This was really just so i had a bit of a better idea of the records
    20. 'and more control over things, yeh i know it made some unnesscry code :P
    21. While rs.EOF = False
    22.     Counter = Counter + 1
    23.     rs.MoveNext
    24. Wend
    25.      
    26.  
    27. If Counter >= 1 Then
    28. rs.MoveFirst
    29.      
    30.     For k = 1 To Counter
    31.         For i = 1 To ServiceSocket.UBound
    32.             If i = rs(1).Value Then 'rs(1) is a users socketindex
    33.                 If ServiceSocket(i).State = sckConnected Then
    34.                     'Send status of user to its buddies if they are online
    35.                     ServiceSocket(i).SendData ".statusUpdate 1" & " " & user & " " & status
    36.                 End If
    37.             End If
    38.         Next i
    39.         rs.MoveNext
    40.     Next k
    41. End If
    42.  
    43. If ServiceSocket(index).State = sckConnected Then
    44.     ServiceSocket(index).SendData ".statusUpdate 0"
    45. End If

  11. #51

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    158

    Re: Type Mismatch

    hmm i tried your code, and it still doesnt seem to do nething =\

  12. #52
    Addicted Member
    Join Date
    Jul 2006
    Posts
    147

    Re: Type Mismatch

    first i changed the
    VB Code:
    1. ElseIf Word(strIncoming, 1) = ".updateStatus" Then 'Updates User status: online, away, etc
    2.           Call update_status(Word(strIncoming, 2), Word(strIncoming, 3), Index)

    bit, then i altered the code in the status_update func(above). put a msgbox at the very start of the status update func, can say nething, then click the msgbox's away whenever they appear when your running it

  13. #53

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    158

    Re: Type Mismatch

    ok sweet this is getting better...and i thank you sooooo much for helping me, but we are almost there, but now the user signs on and the other user doesnt get anything saying that they signed on...BUT......when i send a msg to him he does not get the first msg, but his buddylist shows that im online now as if i just signed on, but only when i send him the first msg

  14. #54
    Addicted Member
    Join Date
    Jul 2006
    Posts
    147

    Re: Type Mismatch

    is that with the msgbox in there? i was testing with 3 clients as long as there was a msgbox going off in update_status thingy it worked purrrrfect, otherwise the updates didnt work out right.. but the msgbox is a pain, il try figure it out again tonite

  15. #55

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    158

    Re: Type Mismatch

    hmm well i used all the code u provided me with and i didnt get any msgboxes

  16. #56
    Addicted Member
    Join Date
    Jul 2006
    Posts
    147

    Re: Type Mismatch

    aaa i didnt put the msgbox in that code
    just chuck one in anywhere, IE

    VB Code:
    1. Private Function update_status(status As Integer, user As String, index As integer)
    2. msgbox "meh"
    3. Dim rs As New ADODB.Recordset

    its annoying because nothing happens at the client end til u get rida the boxes... dont keep hitting the signon button repeatidly, the server will get lots of signin asks:P

  17. #57

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    158

    Re: Type Mismatch

    whoa.....hmm now it works...kool...but now how do we fix this so that it doesnt need to have sumone here all the time to click "ok"

  18. #58
    Addicted Member
    Join Date
    Jul 2006
    Posts
    147

    Re: Type Mismatch

    im not sure yet we could always hire mendhak to sit there clicking away. besides that.. i dont even know why it does that, im guessing its something to do with the winsock stuff.. like i said this is the first time ive used it il know more when someone replys or i get home to good ol vb6

  19. #59
    Hyperactive Member ZaNi's Avatar
    Join Date
    Jun 2006
    Location
    Australia
    Posts
    360

    Re: Type Mismatch

    I haven't read the whole thread, but it sounds like you could do the same thing with a delay (I don't know what the code is, but you could google it quickly I'm sure)... I assume the msgbox is simply acting as a small delay here... I could be totally wrong, and feel free to disregard all I've put here
    * Don't limit yourself to sanity
    * I'd rather be optimistic and naive than pessimistic and right
    * Ask good questions, get good answers.

    My Codebank submissions:
    How to write one rountine to handle many events
    Accessing and Using variables across multiple forms
    Printing/Previewing a form or control

    Links I've "borrowed" from other people:
    vbdotnetboy - Awesome site for tips

  20. #60
    Hyperactive Member BillGeek's Avatar
    Join Date
    Jun 2006
    Location
    Canada
    Posts
    440

    Re: Type Mismatch

    Exactly... put something like a for loop in there, with a doevents... (If this is your problem...)
    VB Code:
    1. Dim I As Integer
    2.  
    3. For I = 1 To 1000 '-Increase or decrease as you see fit
    4.     DoEvents
    5. Next I
    Just guessing here...

  21. #61

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    158

    Re: Type Mismatch

    well, sry, but that didnt do it, any other ideas? it does say im online when i sign off or when i send a msg to sumone

  22. #62
    Addicted Member
    Join Date
    Jul 2006
    Posts
    147

    Re: Type Mismatch

    I said up a few posts in the long one with the code i tried making a delay.. didnt do much
    even with a 2 second delay noting happens.. almost like it needs a break in the process
    i even sent the data 2ce from the client.. that failed to do anything.. i dont understand what the msgbox could do, besides being a temperary stop in processing?

  23. #63

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    158

    Re: Type Mismatch

    grr this code is starting to get more retarded everytime, cuz now i have it to work with no msgbox but now, the retarded part is that it doesnt get the users buddylist, so when ever sumone signs on, they have no buddies in thier list..

Page 2 of 2 FirstFirst 12

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