Valhalla Legends Forums Archive | C/C++ Programming | Socks & Codewarrior for OSX

AuthorMessageTime
NetNX
how do i use socks in OSX on Codewarrior's C++ im looking for an example on how to do it to get my started :-/
January 13, 2005, 3:33 PM
dyslexify
i assume you mean the code warrior IDE
http://www.metrowerks.com/MW/Develop/CodeWarrior

I've not done much OSX programming, but i'd assume that it's not that much IDE specific.
January 13, 2005, 10:25 PM
UserLoser.
[quote author=Mephisto link=topic=10180.msg95103#msg95103 date=1105646271]
What?
[/quote]
Didn't read it the first time? Here:

[quote author=NetNX link=topic=10180.msg95075#msg95075 date=1105630422]
[size=4] how do i use socks in OSX on Codewarrior's C++ im looking for an example on how to do it to get my started :-/[/size]
[/quote]
January 14, 2005, 4:16 AM
warz
Wait, now I missed it. I didn't catch it the first or second time. What'd he say?
January 14, 2005, 4:39 AM
warz
[quote author=Mephisto link=topic=10180.msg95193#msg95193 date=1105682790]
Just sounded like a really stupid question at first.  Never heard of CodeWarrior before so I assumed he was an idiot (oh well); and I never made the connection of OSX to Macintosh.
[/quote]

Well now who is the idiot? Jumped to conclusions on topics you didn't even know about, without searching before commenting.
January 14, 2005, 6:13 AM
NetNX
<3 warz... I don't really care what people think of me aslong as i get my question answered :-/ if they wanna sit there and call me an idiot thats their waste of time...

just trying to learn something new :)
January 14, 2005, 3:15 PM
Mephisto
[quote author=NetNX link=topic=10180.msg95209#msg95209 date=1105715707]
<3 warz... I don't really care what people think of me aslong as i get my question answered :-/ if they wanna sit there and call me an idiot thats their waste of time...

just trying to learn something new :)
[/quote]

I never called you an idiot; and regardless of the comment I posted foolishly, I still think your question is aloof because I don't think you can program well enough to go onto socket programming; but prove me wrong by all means.
January 14, 2005, 7:57 PM
NetNX
[code]
Private Sub sckAccept_DataArrival(Index As Integer, ByVal bytesTotal As Long)
    Dim i As Integer
    Dim b As String
    Dim c As String
    Dim sData As String
    Dim pByte As String
    Dim cData As String
    Dim a() As String
    sckAccept(Index).GetData sData
    Do Until sData = ""
    If InStr(sData, vbCrLf) = 0 Then
        cData = sData
        sData = ""
    Else
        a() = Split(sData, vbCrLf, 2)
        sData = a(1)
        cData = a(0)
    End If
        'DebugText "Processing:" & cData
       
        pByte = Left(cData, 1)
        cData = Right(cData, Len(cData) - 1)
        Select Case pByte
            Case Chr(0)
                If Len(cData) > 12 Then
                    DebugText "Man i think nigglets try'n hack u! Lets IP them :-X Winsock.Connect 'useast.battle.net',6112 repeat 12x times yaya :)"
                    modServer.sUSER(Index) = ""
                Else
                    DebugText "Username Recieved!"
                    modServer.sUSER(Index) = cData
                End If
                sckAccept(Index).SendData Chr(2) & vbCrLf
            Case Chr(1)
                If Len(cData) > 12 Then
                    DebugText "DAMN THESE NIGGERS IPBAN FOR U!"
                    sckAccept(Index).SendData Chr(4) & vbCrLf
                    DoEvents
                    Call sckAccept_Close(Index)
                ElseIf cData = "" Then
                    sckAccept(Index).SendData Chr(4) & vbCrLf
                    DoEvents
                    Call sckAccept_Close(Index)
                ElseIf sUSER(Index) = "" Then
                    sckAccept(Index).SendData Chr(4) & vbCrLf
                    DoEvents
                    Call sckAccept_Close(Index)
                Else
                    On Error GoTo fh1
                    DebugText App.Path & "\accounts\" & sUSER(Index) & ".txt"
                    Open App.Path & "\accounts\" & sUSER(Index) & ".txt" For Input As #1
                        Input #1, b
                        Input #1, c
                    Close #1
                    If cData <> b Then
                        sckAccept(Index).SendData Chr(4) & vbCrLf
                        DoEvents
                        Call sckAccept_Close(Index)
                    Else
                        If c = "3" Then
                            sACC(Index) = "3"
                        End If
                       
                        DebugText "Password Recieved!"
                        sckAccept(Index).SendData Chr(3) & vbCrLf
                        Open App.Path & "\accounts\" & sUSER(Index) & "\Log.txt" For Append As #1
                        Print #1, "-"
                        Print #1, "-"
                        Print #1, "-LoggedOn @ " & Now
                        Close #1
                    End If
                End If
                GoTo fh2
fh1:
    DebugText "Erronious File:" & err.Description & err.Number
    err.Clear
    Resume Next
   
fh2:
            Case Chr(2)
                If Len(cData) > 20 Then GoTo FH3
                lPC(Index) = lPC(Index) + 1
                If sACC(Index) = 3 Then GoTo FH3
                If lSta(Index) = LIST_PROXY Then
                    Open App.Path & "\accounts\" & sUSER(Index) & "\Log.txt" For Append As #1
                        Print #1, cData
                    Close #1
                Else
                    Open App.Path & "\accounts\" & sUSER(Index) & "\Log.txt" For Append As #1
                        Print #1, "-"
                        Print #1, "-Listing Proxys...."
                        Print #1, cData
                    Close #1
                    lSta(Index) = LIST_PROXY
                End If
FH3:
            Case Chr(3)
                If Len(cData) > 40 Then GoTo FH4
                lCK(Index) = lCK(Index) + 1
                If sACC(Index) = 3 Then GoTo FH4
                If lSta(Index) = LIST_CDKEY Then
                    Open App.Path & "\accounts\" & sUSER(Index) & "\Log.txt" For Append As #1
                        Print #1, cData
                    Close #1
                Else
                    Open App.Path & "\accounts\" & sUSER(Index) & "\Log.txt" For Append As #1
                        Print #1, "-"
                        Print #1, "-Listing Cdkeys...."
                        Print #1, cData
                    Close #1
                    lSta(Index) = LIST_CDKEY
                End If
FH4:
            Case Chr(4)
          ' On Error GoTo FH5
'taken out
            GoTo FH6
FH5:
            DoEvents
            Call sckAccept_Close(Index)
FH6:
            Else
                DoEvents
                Call sckAccept_Close(Index)
            End If
        End Select
    Loop
End Sub
[/code]

eh... my code gota love them bd servers... im just trying to figure out the whole C++ thing in general.... and socks is where id like to start...
January 15, 2005, 3:50 PM
Mephisto
You know nothing about C++ and you want to learn about sockets first?  Needless to say that's a stupid idea.  If you're just starting, here's a good place: http://www.gametutorials.com.
January 15, 2005, 11:33 PM
NetNX
ill try it... but if u know where i could find a socks example for codewarrior that would help also ~_^ thanks for not being a complete penis like the rest of this forum's members...
January 17, 2005, 2:14 PM
St0rm.iD
NetNX: http://developer.apple.com/documentation/Porting/Conceptual/win32porting/Articles/networking.html

BUT: that code you posted in VB is terrible (sry). Too many gotos; go read online about how you should really structure your code, and buy a book. You should really learn basic programming concepts and techniques before delving into a larger project.

Mephisto: you're a friggin retard, and to cover it up you decided to use the word "aloof"
January 17, 2005, 3:05 PM
Mephisto
I could say the same thing about you.
January 17, 2005, 5:55 PM
warz
[quote author=Mephisto link=topic=10180.msg95514#msg95514 date=1105984545]
I could say the same thing about you.
[/quote]

True come back of a retard.
January 17, 2005, 7:09 PM
St0rm.iD
[quote author=Mephisto link=topic=10180.msg95514#msg95514 date=1105984545]
I could say the same thing about you.
[/quote]

i know you are but what am i
January 17, 2005, 8:25 PM
Zakath
$t0rm is a proven programmer, his expertise (if not always his personality) well-respected by many in this community (and a friend of mine besides).

Let's keep the flames clear of the topic, gentlemen.
January 17, 2005, 8:25 PM
Mephisto
*shrug*
January 17, 2005, 10:13 PM
NetNX
[quote author=Banana fanna fo fanna link=topic=10180.msg95499#msg95499 date=1105974359]
NetNX: http://developer.apple.com/documentation/Porting/Conceptual/win32porting/Articles/networking.html

BUT: that code you posted in VB is terrible (sry). Too many gotos; go read online about how you should really structure your code, and buy a book. You should really learn basic programming concepts and techniques before delving into a larger project.

Mephisto: you're a friggin retard, and to cover it up you decided to use the word "aloof"

[/quote]

Wasn't trying to show off.. i was mearly trying to prove a point that i can infact conjurgate(sp?) my own programs and write them i know that goto's are inefficant i wrote that code late at night and without thinking too much i could fix it but im not using it anymore. This program is just unrelated to the whole bot programing thing because when you post u know "bots" source code people are all like  you stole from so and so blah bla blah just cuz u can copy something done already dosent make you a programer... get what im saying here?
January 18, 2005, 3:47 PM
Grok
[quote author=NetNX link=topic=10180.msg95298#msg95298 date=1105804227]
[code]
Private Sub sckAccept_DataArrival(Index As Integer, ByVal bytesTotal As Long)
........
End Sub
[/code]

eh... my code gota love them bd servers... im just trying to figure out the whole C++ thing in general.... and socks is where id like to start...
[/quote]

IMHO, your DataArrival event procedure should be no more than about 3 lines of code, plus error handling.  Think about what DataArrival event is all about, data arriving.  When it arrives, your immediate job is to receive it, and then call something to take action on it.  So in the arrival procedure, just do that.  Receive it into whatever buffer setup you have, then call/notify another procedure to take action on the new data.

Structuring as suggested will keep your procedures clean, readable, maintanable, and make you a better programmer.  But like I say, just a suggestion, and my own opinion and preference.
January 18, 2005, 7:07 PM
NetNX
Yea.. I understand that, But its good advice :)
January 19, 2005, 3:17 PM

Search