Posted: Sat Jul 27, 2002 5:03 am
Restored from previous forum. Originally posted by ricardo.
Hi everybody !!
Just taking a time to visit the comunity and download the new version of PB (Looks great!!).
Im playing with the possibilitie of develop a small IRC client, i done some before in VB.
Now... my questions:
I do connect succesfully
Port = 6663
ConnectionID = OpenNetworkConnection("toast.DAL.net", Port)
Then i need to pass some raw data to the server, in VB it looks like this:
irc.SendData "User " & EMail & " " & irc.LocalHostName & " " & irc.RemoteHost & " :" & RealName & vbCrLf
irc.SendData "NICK " & NickName & vbCrLf
I try to this something similar in PB doing:
If ConnectionID
MessageRequester("PureBasic IRC - Client", "Client connected to server...", 0)
PokeS(TextBuffer, "User [url]mailto:mymail@yahoo.com[/url] 209.13.250.61 ricardo")
Delay (1000)
SendNetworkData(ConnectionID, TextBuffer,1000)
PokeS(TextBuffer, "Nick ricardo")
Delay (1000)
SendNetworkData(ConnectionID, TextBuffer,1000)
EndIf
But something is missing since the server dont let me in and quit me because some timerout of ping.
In VB this easy steps make the server to let me in and then i only need to send some easy raw data and i have a IRC client.
Could some one help me?
My code is a mess but i put it here to see if someone get how to workarround the problem. Thanks in advance.
-------------------------------------------------------------------------------
If InitNetwork() = 0
MessageRequester("Error", "Can't initialize the network !", 0)
End
EndIf
#WINDOW_PARAMETERS = #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget
Port = 6663
Buffer = AllocateMemory(0, 1000, 0)
TextBuffer = AllocateMemory(1, 1000, 0)
If OpenWindow(0,100,100, 300, 300, #WINDOW_PARAMETERS ,"IRC CLIENT")
If CreateGadgetList(WindowID())
StringGadget(1, 100, 250, 150, 20, "")
EndIf
ConnectionID = OpenNetworkConnection("toast.DAL.net", Port)
If ConnectionID
MessageRequester("PureBasic - Client", "Client connected to server...", 0)
PokeS(TextBuffer, "User [url]mailto:ricardoarias@yahoo.com[/url] 209.13.250.61 ricardo")
Delay (1000)
SendNetworkData(ConnectionID, TextBuffer,1000)
PokeS(TextBuffer, "Nick ricardo")
Delay (1000)
SendNetworkData(ConnectionID, TextBuffer,1000)
Else
end
EndIf
Repeat
EventID.l = WaitWindowEvent()
;SendNetworkString(ConnectionID, "PING")
Result = ReceiveNetworkData(ConnectionID, Buffer, 1000)
If result
MessageRequester("data",PeekS(Buffer),0)
SendNetworkString(ConnectionID, "PING")
EndIf
Until EventID = #PB_EventCloseWindow
EndIf
CloseNetworkConnection(ConnectionID)
End
Hi everybody !!
Just taking a time to visit the comunity and download the new version of PB (Looks great!!).
Im playing with the possibilitie of develop a small IRC client, i done some before in VB.
Now... my questions:
I do connect succesfully
Port = 6663
ConnectionID = OpenNetworkConnection("toast.DAL.net", Port)
Then i need to pass some raw data to the server, in VB it looks like this:
irc.SendData "User " & EMail & " " & irc.LocalHostName & " " & irc.RemoteHost & " :" & RealName & vbCrLf
irc.SendData "NICK " & NickName & vbCrLf
I try to this something similar in PB doing:
If ConnectionID
MessageRequester("PureBasic IRC - Client", "Client connected to server...", 0)
PokeS(TextBuffer, "User [url]mailto:mymail@yahoo.com[/url] 209.13.250.61 ricardo")
Delay (1000)
SendNetworkData(ConnectionID, TextBuffer,1000)
PokeS(TextBuffer, "Nick ricardo")
Delay (1000)
SendNetworkData(ConnectionID, TextBuffer,1000)
EndIf
But something is missing since the server dont let me in and quit me because some timerout of ping.
In VB this easy steps make the server to let me in and then i only need to send some easy raw data and i have a IRC client.
Could some one help me?
My code is a mess but i put it here to see if someone get how to workarround the problem. Thanks in advance.
-------------------------------------------------------------------------------
If InitNetwork() = 0
MessageRequester("Error", "Can't initialize the network !", 0)
End
EndIf
#WINDOW_PARAMETERS = #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget
Port = 6663
Buffer = AllocateMemory(0, 1000, 0)
TextBuffer = AllocateMemory(1, 1000, 0)
If OpenWindow(0,100,100, 300, 300, #WINDOW_PARAMETERS ,"IRC CLIENT")
If CreateGadgetList(WindowID())
StringGadget(1, 100, 250, 150, 20, "")
EndIf
ConnectionID = OpenNetworkConnection("toast.DAL.net", Port)
If ConnectionID
MessageRequester("PureBasic - Client", "Client connected to server...", 0)
PokeS(TextBuffer, "User [url]mailto:ricardoarias@yahoo.com[/url] 209.13.250.61 ricardo")
Delay (1000)
SendNetworkData(ConnectionID, TextBuffer,1000)
PokeS(TextBuffer, "Nick ricardo")
Delay (1000)
SendNetworkData(ConnectionID, TextBuffer,1000)
Else
end
EndIf
Repeat
EventID.l = WaitWindowEvent()
;SendNetworkString(ConnectionID, "PING")
Result = ReceiveNetworkData(ConnectionID, Buffer, 1000)
If result
MessageRequester("data",PeekS(Buffer),0)
SendNetworkString(ConnectionID, "PING")
EndIf
Until EventID = #PB_EventCloseWindow
EndIf
CloseNetworkConnection(ConnectionID)
End