|
-
Aug 30th, 2006, 07:12 PM
#41
Addicted Member
Re: Type Mismatch
Where/how did you make servicesocket and what exactly does it contain?
-
Aug 30th, 2006, 07:47 PM
#42
Thread Starter
Addicted Member
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
-
Aug 30th, 2006, 09:08 PM
#43
Addicted Member
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
-
Aug 30th, 2006, 09:29 PM
#44
Thread Starter
Addicted Member
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
-
Aug 30th, 2006, 10:21 PM
#45
Addicted Member
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:
[B]msgbox ServiceSocket.UBound[/B]
For i = 1 To ServiceSocket.UBound
[B]msgbox i & " " & servicesocket(i)[/B]
testing = ServiceSocket(i).Index
If ServiceSocket(i).Index = rs.Fields("oindex") Then
If ServiceSocket(i).State = sckConnected Then
ServiceSocket(i).SendData ".statusUpdate 1" & " " & user & " " & status 'send status of user to its buddies if their online
End If
End If
[B] EXIT FUNCTION[/B]
Next i
-
Aug 30th, 2006, 10:48 PM
#46
Thread Starter
Addicted Member
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
-
Aug 30th, 2006, 11:04 PM
#47
Addicted Member
Re: Type Mismatch
VB Code:
rs.Open "SELECT buddy, oindex FROM buddies, online WHERE buddies.buddy = '" + _
CStr(user) + "' AND buddies.user = online.username", conn
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
-
Aug 30th, 2006, 11:52 PM
#48
Thread Starter
Addicted Member
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
-
Aug 31st, 2006, 05:20 AM
#49
Addicted Member
Re: Type Mismatch
um
VB Code:
ElseIf Word(strIncoming, 1) = ".updateStatus" Then 'Updates User status: online, away, etc
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.
-
Aug 31st, 2006, 08:52 AM
#50
Addicted Member
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:
Private Function update_status(status As Integer, user As String, index As integer)
Dim rs As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim conn As New ADODB.Connection
Dim Counter As Integer
conn.Open sConnString
If ServiceSocket(index).State = sckConnected Then
rs2.Open "UPDATE online SET ostatus = " & CStr(status) & " WHERE username = '" + _
CStr(user) + "' AND oindex = " & CStr(index), conn
End If
'Gets the ppl that have user as buddies that are currently online
rs.Open "SELECT buddy, oindex FROM buddies, online WHERE buddies.buddy = '" + _
CStr(user) + "' AND buddies.user = online.username", conn
'This was really just so i had a bit of a better idea of the records
'and more control over things, yeh i know it made some unnesscry code :P
While rs.EOF = False
Counter = Counter + 1
rs.MoveNext
Wend
If Counter >= 1 Then
rs.MoveFirst
For k = 1 To Counter
For i = 1 To ServiceSocket.UBound
If i = rs(1).Value Then 'rs(1) is a users socketindex
If ServiceSocket(i).State = sckConnected Then
'Send status of user to its buddies if they are online
ServiceSocket(i).SendData ".statusUpdate 1" & " " & user & " " & status
End If
End If
Next i
rs.MoveNext
Next k
End If
If ServiceSocket(index).State = sckConnected Then
ServiceSocket(index).SendData ".statusUpdate 0"
End If
-
Aug 31st, 2006, 12:39 PM
#51
Thread Starter
Addicted Member
Re: Type Mismatch
hmm i tried your code, and it still doesnt seem to do nething =\
-
Aug 31st, 2006, 08:59 PM
#52
Addicted Member
Re: Type Mismatch
first i changed the
VB Code:
ElseIf Word(strIncoming, 1) = ".updateStatus" Then 'Updates User status: online, away, etc
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
-
Aug 31st, 2006, 09:47 PM
#53
Thread Starter
Addicted Member
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
-
Aug 31st, 2006, 10:05 PM
#54
Addicted Member
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
-
Aug 31st, 2006, 10:18 PM
#55
Thread Starter
Addicted Member
Re: Type Mismatch
hmm well i used all the code u provided me with and i didnt get any msgboxes
-
Aug 31st, 2006, 10:25 PM
#56
Addicted Member
Re: Type Mismatch
aaa i didnt put the msgbox in that code
just chuck one in anywhere, IE
VB Code:
Private Function update_status(status As Integer, user As String, index As integer)
msgbox "meh"
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
-
Aug 31st, 2006, 10:28 PM
#57
Thread Starter
Addicted Member
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"
-
Aug 31st, 2006, 11:57 PM
#58
Addicted Member
-
Sep 1st, 2006, 01:08 AM
#59
Hyperactive Member
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
-
Sep 1st, 2006, 01:15 AM
#60
Hyperactive Member
Re: Type Mismatch
Exactly... put something like a for loop in there, with a doevents... (If this is your problem...)
VB Code:
Dim I As Integer
For I = 1 To 1000 '-Increase or decrease as you see fit
DoEvents
Next I
Just guessing here...
-
Sep 1st, 2006, 02:20 AM
#61
Thread Starter
Addicted Member
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
-
Sep 1st, 2006, 03:03 AM
#62
Addicted Member
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?
-
Sep 1st, 2006, 01:34 PM
#63
Thread Starter
Addicted Member
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..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|