Snippets in category Networking
Setting the user agent of a Web request
Some Web sites deny requests that aren't sent by recognized browsers and search engine crawlers. Setting the user agent header of the request is usually sufficient for bypassing this restriction.
20 people like this
Posted: 1 years ago by Taha HachanaConvert an object to json, and json to object
There is a namespace System.Runtime.Serialization.Json To serialize generic object you can do like this...
40 people like this
Posted: 1 years ago by Tuomas HietanenAsync SMTP
Async wrapper for SmtpClient (which is event-based)
9 people like this
Posted: 1 years ago by Mauricio SchefferAsync TCP Server
A basic, asynchronous TCP server
15 people like this
Posted: 1 years ago by Ryan RileyGet Stock Quote Data and Historical Stock Prices from Yahoo Finance
Get Stock Quote Data and Historical Stock Prices from Yahoo Finance.
135 people like this
Posted: 1 years ago by Tuomas HietanenSimple HTTP server with Async workflow
Simple HTTP server with Async workflow and Http Listener
1 people like this
Posted: 1 years ago by Ankur DhamaURL Canonicalization
This function produces safe URLs for Web requests or URI construction. It forces the pattern: http:// + www. OR subdomain. + domain + absolute path. When used in an application that takes URLs as input, the user would be able to type "example.com" instead of "http://example.com" or "http://www.example.com". It also supports domains like google.co.uk or google.com.au.
8 people like this
Posted: 1 years ago by Taha HachanaUri Parser
A Uri parser using the Cashel library [1]. This implementation is using ArraySegment<byte> as the underlying state, as I'm using it within a server, but it would be trivial to switch it to using a list. Also, note that I am not parsing the Uri into any specific structure, though that, too, would be trivial. For my current purposes, I just needed to validate the Uri. [1] https://github.com/panesofglass/cashel
20 people like this
Posted: 1 years ago by Ryan RileyParse HTTP chunked response
Code to parse HTTP chunked response, to use as a client to a Comet server who uses chunked encoding to transfer real time notification data
1 people like this
Posted: 1 years ago by Ankur DhamaF# googelsearch
A google search automation.
19 people like this
Posted: 1 years ago by Chief Inspector ClouseauTCP/IP Proxy
A minimal TCP/IP proxy implementation with F# asynchronous workflows
11 people like this
Posted: 1 years ago by Ademar GonzalezSimple Redis F# Client Test
Simple Redis F# Client Test (Async version will stop respond when data are too large. Don't know how to solve yet.)
1 people like this
Posted: 1 years ago by Richard ChangAsync SNTP client
An asynchronous SNTP client that can retrieve the current time from an internet time server (such as time-a.nist.gov) and optionally update the local system clock to match. Demonstrates async UDP communication, bit-shifting, and native interop/PInvoke.
8 people like this
Posted: 1 years ago by Joel Mueller
Sequence Generator from Async
Generates a sequence using a sequence generator and Async.StartWithContinuations. This is an attempt at modeling the OWIN delegate structure in F#
4 people like this
Posted: 11 months ago by Ryan RileySilverlight asynchronous WebService call with UI-thread syncronization dispatcher
You can use this code to make a async WebRequest from Silverlight to update ViewModel.
4 people like this
Posted: 11 months ago by Tuomas HietanenExtensions for HTTP servers
This snippet extends several types from the System.Net namespace. It provides an easy to use API for creating asynchronous (as well as synchronous) HTTP servers using F# asynchronous workflows.
3 people like this
Posted: 10 months ago by Tomas PetricekSynchronous, event-based and asynchronous HTTP proxy
This snippet shows the implementation of three HTTP proxy servers in F#. The first is written using simple synchronous style (that isn't scalable). The second version uses event-based approach in the Node.js style, but is difficult to write. The third version uses F# async workflows and is both scalable and easy to write.
5 people like this
Posted: 10 months ago by Tomas PetricekAsynchronous HTTP proxy with chunking and caching
This snippet shows two improvements to asynchronous HTTP proxy from: http://fssnip.net/6e. First extension is to process page in chunks (instead of downloading the entire content first). The second extension is to use simple agent-based in-memory cache for previously visited pages.
5 people like this
Posted: 10 months ago by Tomas PetricekJSON Parser
JSON Parser using Regular Expressions & Active Patterns (just for fun).
5 people like this
Posted: 7 months ago by Phillip TrelfordCaching agent
Agent that keeps a cache of web pages that were downloaded previously. The agent handles messages to add and get data as well as message to clear the cache.
2 people like this
Posted: 6 months ago by Tomas PetricekActive pattern to extract HttpStatusCode from WebException
A simple active pattern that allows you to match WebExceptions by HttpStatusCode. I find it useful for quick scripts where I only need WebClient and don't have to get involved with WebRequest etc.
5 people like this
Posted: 5 months ago by Leaf GarlandSend HTTP POST request
The snippet shows how to send HTTP POST request to a web page and download the generated HTML result. The POST data is encoded as a byte array and written to the request stream of HttpWebRequest.
2 people like this
Posted: 3 months ago by Tomas PetricekStackOverflowCrawler
Tries to find the best technologies from stackoverflow. Don't use too wide tags (with many thousand request) or firewall will block you!
Stackoverflow API script
A script that consumes the Stackoverflow API in a dynamic fashion
5 people like this
Posted: 3 months ago by Mauricio SchefferLightweight syntax for creating JSon objects using Newtonsoft's Json.Net
There's an easy way to create JSon objects using Newtonsoft's Json.Net. The common problem with Json.Net is that there's usualy a lot of overhead when creating Json with it as there're a lot of 'new', parentheses, nested objects when we don't need them. And it becomes annoying quite fast. DU Json and toJson function allow to create Json tree and convert it to Json.Net JObject hierarchy. On the examples the usage of lightweight syntax doesn't give a lot of win but it will be more clearer when it come to more complicated objects.
4 people like this
Posted: 1 months ago by Dmitry LobanovAsync HTTP server
Creating an asynchronous HTTP Server in F#.
6 people like this
Posted: 1 months ago by Julian Kay