![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Code Samples & Tips Share your recent discoveries and ideas with other users. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
Thanks to agraham for answering mamuen's question. I seem to have fallen asleep at the wheel
![]() I'm glad this example is proving to be useful. Having access to a TCP socket is hugely powerful and allows you to do a lot of different things. For a far more complex example, check out my TCP socket-based FTP example here: Low-level FTP upload with progress All the best,
__________________
Brian Rathbone Laptop: AMD Turion 64 Mobile 2ghz, 2GB RAM, Dual GeForce Go 7900 GTX 768MB SLI, Dual 200GB HDD at RAID0. XP Pro sp2 Device: Treo 750, WM6, 300mhz,128MB RAM, 2GB miniSD, 240x240 display |
|
||||
|
Hi Brian,
Thanks to your post I checked the dict.org site exploring all its query features. I felt that more information is provided via HTTP access and wrote a little app that sends a query string, parses the returned HTML file and displays the result. I still have to work on formatting the result text. Help File and Download CAB menus are still dummy functions. BTW, how do you know whether a server allows TCP access and the required parameters? A weather data server would be nice for TCP access, wouldn't it. Anyway, thanks a lot for the inspiration. Cheers Robert |
|
||||
|
Hi Robert,
Nice app! The HTTP approach will be very useful when talking to most web based apps. The TCP socket approach is lower-level, but useful when HTTP access is not present. I started playing with network.dll to figure out how to create a Basic4PPC version of my remote technical support software for handhelds. It's basically on demand remote technical support for multiple platforms. Regarding TCP access to various servers, the process ranges from reading RFCs and documentation to black art. Dict.org is such a great example because it is free and fairly well documented, although reading RFCs is not exactly fun. This approach is the best learning exprience, IMO. If you don't really want to know all the ins and outs of the protocol, it is often better to look for open source projects in other languages and port the code. Here are a couple examples of what I use TCP sockets for and, in short, how I figured them out: FTP - Read the RFCs and looked at open-source FTP code. Flash - I wrote a TCP server that communicated with a Flash/Actionscript web page using Flash's XMLSocket, which is a limited TCP socket in disguise. After connecting to the XMLSocket and having it write data to my client socket, I looked at each character as they came in (using ASC) and figured out that Flash's XML socket terminates every command with CHR(0). Most protocols that use terminator-based commands use CHR(13) & CHR(10), aka vbCRLF, as the terminator. Once I knew the terminator, which is used for sending and receiving, implementing my own custom protocol was no problem. HTTP + Proxy server + progress - Using a TCP socket, we can build an HTTP socket from the ground up. This can be useful, as shown in the FTP example, to get low-level access to the protocol, and get the ability to provide progress during downloads. I haven't looked for a HTTP download with progress project in Basic4PPc yet, but if one doesn't exist, I'll probably port my HTTP code. Lastly, if you need to figure out a protocol using more brute-force methods, then I recommend using telnet to connect to the host on the specified port and see what you get. For example, if you telnet to a FTP server on port 21, and follow the sequence in my example code, you can manually type in the protocol commands in telnet. It's pretty cool. Another way to do this is to use a packet sniffer to watch the TCP conversation between client and host. None of this is easy, but it can be very worthwhile. I hope all my rambling is helpful. Let me know if I can be of assistance. All the best,
__________________
Brian Rathbone Laptop: AMD Turion 64 Mobile 2ghz, 2GB RAM, Dual GeForce Go 7900 GTX 768MB SLI, Dual 200GB HDD at RAID0. XP Pro sp2 Device: Treo 750, WM6, 300mhz,128MB RAM, 2GB miniSD, 240x240 display |
|
||||
|
Robert,
Regarding your interest in a weather server, have a look at: http://developer.yahoo.com/weather/#examples You can use your HTTP request method and get back an XML response. You can pass either latitude and longitude, Yahoo location code, or postal code. For non-commercial use, this should work great. I found another similar API: http://meteostone.com/api/ I signed up for an API key and got one, but I just can't seem to get it to actually return me any weather data. All the best,
__________________
Brian Rathbone Laptop: AMD Turion 64 Mobile 2ghz, 2GB RAM, Dual GeForce Go 7900 GTX 768MB SLI, Dual 200GB HDD at RAID0. XP Pro sp2 Device: Treo 750, WM6, 300mhz,128MB RAM, 2GB miniSD, 240x240 display |
|
||||
|
Hi Brian,
Thanks a lot for the URLs. XML is a welcome format. Presently, I am parsing weather data from http://i.wund.com/cgi-bin/findweathe...?query=okinawa Wunderground offers short update cycles and their accuracy ain't bad at all, even for non-US locations ![]() A CF type weather station with temperature, humidity and pressure sensor would be nice for Pocket PCs... not talking about space weather ![]() Thanks for your kindness Robert |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MPD client for Windows Mobil | mamuen | Open Source Projects | 1 | 06-01-2008 12:21 PM |
| Client for MPD | mamuen | German Forum | 17 | 03-19-2008 10:15 PM |
| How to achieve text edtion like in word? | Cableguy | Questions & Help Needed | 3 | 07-03-2007 03:52 PM |
| open a text file with Word | mwaite | Questions & Help Needed | 6 | 06-16-2007 09:03 AM |
| FTP Client | PatrikL | Share Your Creations | 2 | 05-05-2007 06:54 AM |