Question: I'm new to iOS, and am learning to code with Swift. My app needs to measure the signal strength. I've found this code working on Objective-C/C, and need some help to implement on Swift. Here is what I got. Hope someone can help me finish it.

**OBJECTIVE C**

```
    int getSignalStrength()
    {
       void *libHandle = dlopen("/System/Library/Frameworks/CoreTelephony.framework/CoreTelephony", RTLD_LAZY);
       int (*CTGetSignalStrength)();
       CTGetSignalStrength = dlsym(libHandle, "CTGetSignalStrength");
       if( CTGetSignalStrength == NULL) NSLog(@"Could not find CTGetSignalStrength");
       int result = CTGetSignalStrength();
       dlclose(libHandle);
       return result;
    }

```

**SWIFT** 

```
    func getSignalStrength()->Int{
       var result : Int! = 0
       let libHandle = dlopen ("/System/Library/Frameworks/CoreTelephony.framework/CoreTelephony", RTD_LAZY)
       ** help **
       var CTGetSignalStrength = dlsym(libHandle, "CTGetSignalStrength")
       if (CTGetSignalStrength != nil){
           result = CTGetSignalStrength()
       }
       dlclose(libHandle)
       return result
    }

```

Answer: 
I found the solution to my problem:

I want to set: httpWebRequest.AllowReadStreamBuffering = false;

HttpClient 4.0 does buffering by default and you cannot acces the property AllowReadStreamBuffering, so you have to use HttpWebRequest directly. (Or you can use HttpClinet 4.5, there is the default behaviour 'streaming') see: <http://www.strathweb.com/2012/09/dealing-with-large-files-in-asp-net-web-api/> 6. Using HttpClient)

The second problem was fiddler: Fiddler currently only supports streaming of responses and not requests ([Fiddler makes HttpWebRequest/HttpClient behaviour unexpected](https://stackoverflow.com/questions/13824717/fiddler-makes-httpwebrequest-httpclient-behaviour-unexpected))

The solution that worked for me:

```
HttpWebRequest httpWebRequest = HttpWebRequest.Create(...)
httpWebRequest.Method = "POST";
         httpWebRequest.Headers["Authorization"] = "Basic " + ...;
         httpWebRequest.PreAuthenticate = true;
         httpWebRequest.AllowWriteStreamBuffering = false;
         httpWebRequest.AllowReadStreamBuffering = false;
         httpWebRequest.ContentType = "application/octet-stream";
         Stream st = httpWebRequest.GetRequestStream();
st.Write(b, 0, b.Length);
st.Write(b, 0, b.Length);
//...
         Task<WebResponse> response = httpWebRequest.GetResponseAsync();

         var x = response.Result;
         Stream resultStream = x.GetResponseStream();
//... read result-stream ...

```
Make sure to do `requestMessage.Headers.TransferEncodingChunked = true;` on your request message...the reason is if you do not set this, HttpClient would buffer the entire content at the client itself in order to figure out the Content-length of the request and this is the reason you are noticing your web api service not being invoked immediately as you are writing to the stream...