Hi, I've done a lot of programming in Blitz3d, but I'm working with BlitzPlus pretty much for the first time.
What the hell am I doing worng??
I'm really frustrated. Please help me if you can!
When I run the updated default TCP code given in the online docs for the command OpenTCPStream, it works for Blitz3d but fails in BlitzPlus.
Here are the programs for each. They *should* only very in the output commands...
Here is the program I ran in Blitz3d:
Here is the program I ran in BlitzPlus:
Blitz3d shows the HTML as it should.
BLitzPlus says "Failed 1".
What the hell am I doing worng??
I'm really frustrated. Please help me if you can!
When I run the updated default TCP code given in the online docs for the command OpenTCPStream, it works for Blitz3d but fails in BlitzPlus.
Here are the programs for each. They *should* only very in the output commands...
Here is the program I ran in Blitz3d:
Graphics 800,600 ; OpenTCPStream/CloseTCPStream/ReadAvail Example Print "Connecting..." tcp=OpenTCPStream( "www.blitzbasic.com",80 ) If Not tcp Print "Failed 1.":WaitKey:End Print "Connected! Sending request..." WriteLine tcp,"GET <a href="http://www.blitzbasic.com" target="_blank">http://www.blitzbasic.com</a> HTTP/1.0" WriteLine tcp,"HOST: www.blitzbasic.com" WriteLine tcp,"" If Eof(tcp) Print "Failed 2.":WaitKey:End Print "Request sent! Waiting for reply..." While Not Eof(tcp) Print ReadLine$( tcp ) Print "Bytes available:" + ReadAvail(tcp) Wend If Eof(tcp)=1 Then Print "Success!" Else Print "Error!" CloseTCPStream tcp WaitKey
Here is the program I ran in BlitzPlus:
Global deskwidth=ClientWidth(Desktop()) Global deskheight=ClientHeight(Desktop()) Global winwidth=400 Global winheight=300 Global window=CreateWindow("test",(deskwidth-winwidth)/2,(deskheight-winheight)/2,winwidth,winheight,0,11) Global text_display=CreateTextArea(0,25,winwidth,winheight-75,window) SetGadgetLayout text_display,1,1,1,1 ; OpenTCPStream/CloseTCPStream/ReadAvail Example AddTextAreaText text_display,Chr$(10)+"Connecting..." tcp=OpenTCPStream( "www.blitzbasic.com",80 ) If Not tcp AddTextAreaText text_display,Chr$(10)+"Failed 1.":WaitKey:End AddTextAreaText text_display,Chr$(10)+"Connected! Sending request..." WriteLine tcp,"GET <a href="http://www.blitzbasic.com" target="_blank">http://www.blitzbasic.com</a> HTTP/1.0" WriteLine tcp,"HOST: www.blitzbasic.com" WriteLine tcp,"" If Eof(tcp) AddTextAreaText text_display,Chr$(10)+"Failed 2.":WaitKey:End AddTextAreaText text_display,Chr$(10)+"Request sent! Waiting for reply..." While Not Eof(tcp) AddTextAreaText text_display,Chr$(10)+ReadLine$( tcp ) AddTextAreaText text_display,Chr$(10)+"Bytes available:" + ReadAvail(tcp) Wend If Eof(tcp)=1 Then AddTextAreaText text_display,Chr$(10)+"Success!" Else AddTextAreaText text_display,Chr$(10)+"Error!" CloseTCPStream tcp WaitKey
Blitz3d shows the HTML as it should.
BLitzPlus says "Failed 1".