How to use Network Client and stream parsing stuff...

apstrojny2

Member
Licensed User
Longtime User
My problem is that I'm can't understand how to use the Network Client object... The example in the help is not complete enough because of syntax errors or I do not know how to include or use the client object correctly... The manual or help is just a bit weak for me, the uninformed, and new to B4P...


This is what I want to do...
I want to write a nice little Pocket PC app to file my Faa Flight Plan or get a Faa weather briefing.. The FAA uses a web site (www duats com)
CSC DUATS on the Web 131.131.7.106 port 23....

I wanted to use the Network Client services of Basic for Pocket PC...

Once you connect to port 23 you will get

CSC DUAT System

Session number: 00370


Enter DUAT access code -or- last name: { Now I need parse the stream and then Auto Fill in the my Access Code [CR]...}

{Then you will get}

Enter your password: { Parse and Auto Fill in my Password[CR]}

Then it will list...

DUAT Main Menu

Weather Briefing 1
Flight Plan and Planner 2
Encode 3
Decode 4
Modify Personal Data Profile 5
Service Information 6
Extended Decode 7
FAA/NWS Contractions 8

Select function (or 'Q' to quit): { Parse and I want to sent the Quick File request to get a weather briefing or file a flight plan etc...}

Take this result and save it in a text file and then launch the Windows Mobile Word app so I can review the weather in that text file...

So if someone could get me going that would be awesome...

Thanks again,

Andy
 

apstrojny2

Member
Licensed User
Longtime User
The B4ppc is the Client Side

Hi Erel,

1) I think this Platform is just Awesome!!! It works really nice!!! I wrote some nice weight and balance programs... I just need need to learn more about the librarys and objects... I was a C programmer but never got into C++ thats probably my biggest problem... Any advice will be greatly appreciated or would you recommend a book...

2) Also how can you get a description on the librarys or library help...

3) I'm writing the Client Side... So it must parse the character stream for the Name: and Password:....

4) I tried to get the a look at the Netdemo.zip but when I click on it it is a dead link... I looked at ChitChat so I got it going sorta... Could you make NetDemo.zip available for me?

5) I can't seem to find a description on 'Stream' 'Client' objects and operations... Searching help did not help... The problem is that I need to sift through the buffer character by characters for name: and password: on a character level instead of a string level just incase the item name: or Password: comes in split across two buffer reads... I got it going with this StrIndexOf:


if client.DataAvailable = True Then
Dim bufferbits(8192) As byte
count = stream.ReadBytes(bufferbits(),8192)
buffer = bit.BytesToString(bufferbits(),0,count)

:
:
:

' State = 1 (Look for Name:) if found then reply with Username'

If State = 1 Then
If -1 < StrIndexOf (buffer, "e:",0) Then

stream.WriteBytes (stream.StringToBytes(Uname.text & Chr(10)))

State = 2 'Change State Next State = 2 (Look for Password:)'
End If
End If

6) I can send you the code if you prefer... But you will have to tell me how to attach it...

Thanks again,

Andy
 

Erel

B4X founder
Staff member
Licensed User
Longtime User

apstrojny2

Member
Licensed User
Longtime User
Can't find Client or Stream anywhere in the docs

Hi Erel,

Can't find Client or Stream anywhere in the docs...
I have the pdf reference... I checked out the tutorials... ChitChat helped...

Would the NetDemo.zip which had a dead link help... Code to follow..

Thanks,

Andy
 
Top