{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/comments/68317704","id":68317704,"diff_hunk":"@@ -238,28 +249,124 @@ private SNITCPHandle CreateTcpHandle(string fullServerName, long timerExpire, ob\n             // TCP Format: \n             // tcp:<host name>\\<instance name>\n             // tcp:<host name>,<TCP/IP port number>\n-            int portNumber = 1433;\n-            string[] serverAndPortParts = fullServerName.Split(',');\n \n-            if (serverAndPortParts.Length == 2)\n+            if (fullServerName == null)\n+            {\n+                SNILoadHandle.SingletonInstance.LastError = new SNIError(SNIProviders.TCP_PROV, SNICommon.InvalidConnStringError, new ArgumentNullException());\n+                return null;\n+            }\n+\n+            if (string.IsNullOrWhiteSpace(fullServerName))\n+            {\n+                return new SNITCPHandle(\"localhost\", DefaultSqlServerPort, timerExpire, callbackObject, parallel);\n+            }\n+\n+            string[] serverNamePartsByComma = fullServerName.Split(s_commaSeparator);\n+            string[] serverNamePartsByBackSlash = fullServerName.Split(s_backSlashSeparator);\n+            if (serverNamePartsByComma.Length < 2 && serverNamePartsByBackSlash.Length < 2)\n+            {\n+                return new SNITCPHandle(fullServerName, DefaultSqlServerPort, timerExpire, callbackObject, parallel);\n+            }\n+            else if (serverNamePartsByComma.Length == 2 && serverNamePartsByBackSlash.Length < 2)\n+            {\n+                string hostName = serverNamePartsByComma[0];\n+                int portNumber = -1;\n+                try\n+                {\n+                    portNumber = ushort.Parse(serverNamePartsByComma[1]);\n+                    return new SNITCPHandle(hostName, portNumber, timerExpire, callbackObject, parallel);\n+                }\n+                catch (Exception e)\n+                {\n+                    SNILoadHandle.SingletonInstance.LastError = new SNIError(SNIProviders.TCP_PROV, SNICommon.InvalidConnStringError, e);\n+                    return null;\n+                }\n+            }\n+            else if (serverNamePartsByComma.Length < 2 && serverNamePartsByBackSlash.Length == 2)\n             {\n+                string hostName = serverNamePartsByBackSlash[0];\n+                string instanceName = serverNamePartsByBackSlash[1];\n+                int portNumber = -1;\n                 try\n                 {\n-                    portNumber = ushort.Parse(serverAndPortParts[1]);\n+                    portNumber = GetPortByInstanceName(hostName, instanceName);\n+                    return new SNITCPHandle(hostName, portNumber, timerExpire, callbackObject, parallel);\n                 }\n                 catch (Exception e)\n                 {\n                     SNILoadHandle.SingletonInstance.LastError = new SNIError(SNIProviders.TCP_PROV, SNICommon.InvalidConnStringError, e);\n                     return null;\n                 }\n             }\n-            else if (serverAndPortParts.Length > 2)\n+            else\n             {\n                 SNILoadHandle.SingletonInstance.LastError = new SNIError(SNIProviders.TCP_PROV, 0, SNICommon.InvalidConnStringError, string.Empty);\n                 return null;\n             }\n+        }\n+\n+        /// <summary>\n+        /// Sends CLNT_UCAST_INST request for given instance name to SQL Sever Browser, and receive SVR_RESP from the Browser.\n+        /// </summary>\n+        /// <param name=\"browserEP\">SQL Sever Browser IPEndPoint</param>\n+        /// <param name=\"instanceName\">instance name for CLNT_UCAST_INST request</param>\n+        /// <returns>SVR_RESP packets from SQL Sever Browser</returns>\n+        private static byte[] SendInstanceInfoRequest(string browserHostname, string instanceName)\n+        {\n+            if (String.IsNullOrWhiteSpace(browserHostname) || String.IsNullOrWhiteSpace(instanceName))\n+            {\n+                throw new ArgumentException();\n+            }\n+\n+            const byte CLNT_UCAST_INST = 0x04;","path":"src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIProxy.cs","position":105,"original_position":105,"commit_id":"ace7de11044ca13e0a2d037024e7930bedecb70a","original_commit_id":"ace7de11044ca13e0a2d037024e7930bedecb70a","user":{"login":"corivera","id":12820011,"avatar_url":"https://avatars.githubusercontent.com/u/12820011?v=3","gravatar_id":"","url":"https://api.github.com/users/corivera","html_url":"https://github.com/corivera","followers_url":"https://api.github.com/users/corivera/followers","following_url":"https://api.github.com/users/corivera/following{/other_user}","gists_url":"https://api.github.com/users/corivera/gists{/gist_id}","starred_url":"https://api.github.com/users/corivera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corivera/subscriptions","organizations_url":"https://api.github.com/users/corivera/orgs","repos_url":"https://api.github.com/users/corivera/repos","events_url":"https://api.github.com/users/corivera/events{/privacy}","received_events_url":"https://api.github.com/users/corivera/received_events","type":"User","site_admin":false},"body":"Pascal casing for constants","created_at":"2016-06-23T21:23:33Z","updated_at":"2016-06-23T21:23:33Z","html_url":"https://github.com/dotnet/corefx/pull/9606#discussion_r68317704","pull_request_url":"https://api.github.com/repos/dotnet/corefx/pulls/9606","_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments/68317704"},"html":{"href":"https://github.com/dotnet/corefx/pull/9606#discussion_r68317704"},"pull_request":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/9606"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/9606","id":74826338,"html_url":"https://github.com/dotnet/corefx/pull/9606","diff_url":"https://github.com/dotnet/corefx/pull/9606.diff","patch_url":"https://github.com/dotnet/corefx/pull/9606.patch","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/9606","number":9606,"state":"open","locked":false,"title":"Enabled connecntivity to connect SQL Server by instance name:","user":{"login":"geleems","id":19577035,"avatar_url":"https://avatars.githubusercontent.com/u/19577035?v=3","gravatar_id":"","url":"https://api.github.com/users/geleems","html_url":"https://github.com/geleems","followers_url":"https://api.github.com/users/geleems/followers","following_url":"https://api.github.com/users/geleems/following{/other_user}","gists_url":"https://api.github.com/users/geleems/gists{/gist_id}","starred_url":"https://api.github.com/users/geleems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geleems/subscriptions","organizations_url":"https://api.github.com/users/geleems/orgs","repos_url":"https://api.github.com/users/geleems/repos","events_url":"https://api.github.com/users/geleems/events{/privacy}","received_events_url":"https://api.github.com/users/geleems/received_events","type":"User","site_admin":false},"body":"@corivera @saurabh500 \r\nI made fixes based on the code review comments.","created_at":"2016-06-22T17:41:28Z","updated_at":"2016-06-23T21:23:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8a7a2b94f43e3ad1d2f05e5d6fc36e4c2ea2ff53","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/corefx/pulls/9606/commits","review_comments_url":"https://api.github.com/repos/dotnet/corefx/pulls/9606/comments","review_comment_url":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/9606/comments","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/ace7de11044ca13e0a2d037024e7930bedecb70a","head":{"label":"geleems:SqlClientInstanceName","ref":"SqlClientInstanceName","sha":"ace7de11044ca13e0a2d037024e7930bedecb70a","user":{"login":"geleems","id":19577035,"avatar_url":"https://avatars.githubusercontent.com/u/19577035?v=3","gravatar_id":"","url":"https://api.github.com/users/geleems","html_url":"https://github.com/geleems","followers_url":"https://api.github.com/users/geleems/followers","following_url":"https://api.github.com/users/geleems/following{/other_user}","gists_url":"https://api.github.com/users/geleems/gists{/gist_id}","starred_url":"https://api.github.com/users/geleems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geleems/subscriptions","organizations_url":"https://api.github.com/users/geleems/orgs","repos_url":"https://api.github.com/users/geleems/repos","events_url":"https://api.github.com/users/geleems/events{/privacy}","received_events_url":"https://api.github.com/users/geleems/received_events","type":"User","site_admin":false},"repo":{"id":61589939,"name":"corefx","full_name":"geleems/corefx","owner":{"login":"geleems","id":19577035,"avatar_url":"https://avatars.githubusercontent.com/u/19577035?v=3","gravatar_id":"","url":"https://api.github.com/users/geleems","html_url":"https://github.com/geleems","followers_url":"https://api.github.com/users/geleems/followers","following_url":"https://api.github.com/users/geleems/following{/other_user}","gists_url":"https://api.github.com/users/geleems/gists{/gist_id}","starred_url":"https://api.github.com/users/geleems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geleems/subscriptions","organizations_url":"https://api.github.com/users/geleems/orgs","repos_url":"https://api.github.com/users/geleems/repos","events_url":"https://api.github.com/users/geleems/events{/privacy}","received_events_url":"https://api.github.com/users/geleems/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/geleems/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others.","fork":true,"url":"https://api.github.com/repos/geleems/corefx","forks_url":"https://api.github.com/repos/geleems/corefx/forks","keys_url":"https://api.github.com/repos/geleems/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geleems/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geleems/corefx/teams","hooks_url":"https://api.github.com/repos/geleems/corefx/hooks","issue_events_url":"https://api.github.com/repos/geleems/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/geleems/corefx/events","assignees_url":"https://api.github.com/repos/geleems/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/geleems/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/geleems/corefx/tags","blobs_url":"https://api.github.com/repos/geleems/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geleems/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geleems/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/geleems/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geleems/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/geleems/corefx/languages","stargazers_url":"https://api.github.com/repos/geleems/corefx/stargazers","contributors_url":"https://api.github.com/repos/geleems/corefx/contributors","subscribers_url":"https://api.github.com/repos/geleems/corefx/subscribers","subscription_url":"https://api.github.com/repos/geleems/corefx/subscription","commits_url":"https://api.github.com/repos/geleems/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/geleems/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/geleems/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/geleems/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/geleems/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/geleems/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geleems/corefx/merges","archive_url":"https://api.github.com/repos/geleems/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geleems/corefx/downloads","issues_url":"https://api.github.com/repos/geleems/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/geleems/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/geleems/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/geleems/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geleems/corefx/labels{/name}","releases_url":"https://api.github.com/repos/geleems/corefx/releases{/id}","deployments_url":"https://api.github.com/repos/geleems/corefx/deployments","created_at":"2016-06-21T00:33:04Z","updated_at":"2016-06-21T00:33:29Z","pushed_at":"2016-06-23T20:04:14Z","git_url":"git://github.com/geleems/corefx.git","ssh_url":"git@github.com:geleems/corefx.git","clone_url":"https://github.com/geleems/corefx.git","svn_url":"https://github.com/geleems/corefx","homepage":"https://dotnet.github.io/","size":79501,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"dab51783edcc970f9cfb7d38b12d49fb7ff0fbcb","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":26295345,"name":"corefx","full_name":"dotnet/corefx","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others.","fork":false,"url":"https://api.github.com/repos/dotnet/corefx","forks_url":"https://api.github.com/repos/dotnet/corefx/forks","keys_url":"https://api.github.com/repos/dotnet/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/corefx/teams","hooks_url":"https://api.github.com/repos/dotnet/corefx/hooks","issue_events_url":"https://api.github.com/repos/dotnet/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/corefx/events","assignees_url":"https://api.github.com/repos/dotnet/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/corefx/tags","blobs_url":"https://api.github.com/repos/dotnet/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/corefx/languages","stargazers_url":"https://api.github.com/repos/dotnet/corefx/stargazers","contributors_url":"https://api.github.com/repos/dotnet/corefx/contributors","subscribers_url":"https://api.github.com/repos/dotnet/corefx/subscribers","subscription_url":"https://api.github.com/repos/dotnet/corefx/subscription","commits_url":"https://api.github.com/repos/dotnet/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/corefx/merges","archive_url":"https://api.github.com/repos/dotnet/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/corefx/downloads","issues_url":"https://api.github.com/repos/dotnet/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/corefx/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/corefx/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/corefx/deployments","created_at":"2014-11-06T23:42:48Z","updated_at":"2016-06-23T16:20:04Z","pushed_at":"2016-06-23T21:09:11Z","git_url":"git://github.com/dotnet/corefx.git","ssh_url":"git@github.com:dotnet/corefx.git","clone_url":"https://github.com/dotnet/corefx.git","svn_url":"https://github.com/dotnet/corefx","homepage":"https://dotnet.github.io/","size":109211,"stargazers_count":9928,"watchers_count":9928,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2417,"mirror_url":null,"open_issues_count":1072,"forks":2417,"open_issues":1072,"watchers":9928,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/9606"},"html":{"href":"https://github.com/dotnet/corefx/pull/9606"},"issue":{"href":"https://api.github.com/repos/dotnet/corefx/issues/9606"},"comments":{"href":"https://api.github.com/repos/dotnet/corefx/issues/9606/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/9606/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/9606/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/corefx/statuses/ace7de11044ca13e0a2d037024e7930bedecb70a"}}}}
{"actor":{"display_login":"corivera"}}