Socket Communication in CLR Integration

Does socket communication support CLR integration?

For example: I have a PROC created in CLR Integration.It get all the data from a table and just want to send the data to a TCP server.

Team:

CREATE ASSEMBLY TcpClr FROM 'G:\TcpClrTest.dll' WITH PERMISSION_SET = EXTERNAL_ACCESS GO CREATE PROCEDURE SendDataToSrv ( @NAME nvarchar(20) ) AS EXTERNAL NAME TcpClr.[TcpClrTest.TcpSend].SqlProce; GO EXEC SendDataToSrv 'cdc.dbo_Test_CT' 

Some code in TcpClrTest.dll :

 using (SqlCommand cmd = new SqlCommand("SELECT * FROM tableName", con)) { using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { //string value = reader[0].ToString(); //tcpClient.Write(value); // ......get all data and send to tcp server. } } } 

I have exec with the EXEC SendDataToSrv 'cdc.dbo_Test_CT' command EXEC SendDataToSrv 'cdc.dbo_Test_CT' , the table has 100,000 rows and 18 columns. It will cost about 5 minutes. I also copy the same code into a common function, not CLR Integration, it only costs about 30 seconds. TCP Server and SQL Server running on the same computer. If I delete the tcpClient.Write(value) code, just get the data from the table, it will happen quickly.

In CLR integration, all I have to do to improve

+2
c # sql-server sockets sqlclr
source share

No one has answered this question yet.

See similar questions:

7
Does SQL Server CLR Integration support configuration files?

or similar:

819
What is the difference between a port and a socket?
one hundred
Visual Studio: ContextSwitchDeadlock
3
System.Security.SecurityException: this assembly does not allow partially trusted subscribers
2
C # CLR throws a security exception if not specified as UNSAFE
2
Executing CLR Stored Procedures from SQL Server
2
Why SQL Server CLR procedure hangs in GetResponse () call for web service
2
SQL Server CLR Integration Does Not Call System Time as Expected
2
Sql CLR runtime error
0
Display data from database to shortcut
0
CLR Table Valued Function - checking steps to create

All Articles