Network Programming for the MicrosoftВ® .NET Framework (Pro-Developer)

S

scalability

ASP.NET calls to Web services, 249255

bandwidth, of, 329330

congested networks, 330

defined, 319

FTP bandwidth requirements, 329

memory issues, 327328

operating system networking limitations, 328329

receiving data, 330

Web services, of, 249256

security

authentication. See authentication

authorization. See authorization

code access. See code access security

code groups, 300302

conditional acceptance, 308

conditions for code groups, 300302

DNS spoofing attacks, 303

encryption for sockets, 310311

future evolution for .NET, 343

HTTP with, 311316

idle connections, 310

importance of, 20

Internet zone, 301

Intranet zone, 301

IPSec, 310

My Computer zone, 302

.NET remoting, 271, 316

policy levels, 299300

port sharing, 188189

Security namespace, 9

Security permission, 299

server sockets, 188192

sockets, 188192, 302311

SSL. See SSL (Secure Sockets Layer)

Trusted zone, 302

Untrusted zone, 302

Web services, schemes for, 315

WS-Security, 316

XML digital signatures, 316

Zone conditional access, 301303

Send methods , Socket class, 154157

serial base streams, 27

serialization

advantages, 67

application model for, 18

binary, 6869, 7178

code access security for, 86

defined, 18, 67

deserialization, binary, 7374

deserialization, XML, 80

efficiencies of types compared, 69

exceptions, 74

formats, overview, 6870

ISerializable, 7578

portability of, 68, 69

Serializable attribute, 71, 263

SOAP serialization, 70, 8485

streams, relation to, 68

XML serialization, 6970, 7884

zones prohibited in, 86

server sockets

accept requests , asynchronous, 195197

accepting connections, 186187

asynchronous data transfer, 198200

asynchronous operation of, 192201

backlog parameter, 185

closing, 187, 201

connections, 197

context information, 193

creating, 184185

defined, 183

delegates, 193, 195, 197

displaying with netstat, 184

ExclusiveAddressUse option, 188189

Listen method for, 184185

multiple accept operations, 197

permissions, 189192

postings, asynchronous, 193195

queues, 185

security, 188192

sharing ports, 188189

terminating operations, 195197

threading with, 192

tracking operations, 201

wildcard address, 184, 188189

Service Controller permissions, 298

ServicePoint classes, 115

ServicePointManager class, 228230, 331

ServiceProcess namespace

defined, 9

Windows Services application model, 1415

session identification, 306310

SimpleSocket sample, 146

SimplifiedSocketClasses sample, 178

sinks, channel

client channel sink chains, 283, 288289

CreateMessageSink method, 282

CreateSink method, 284

formatter sinks, 289

IClientChannelSink, 284

IClientChannelSinkProvider, 283

IServerChannelSink, 290291

message sink creation, 282

server sink provider chains, 294295

server transport sink providers, 290294

SetupClientSinkProviders, 288289

transport sinks, 283288, 289

SOAP

class serialization example, 70

code for, 85

customizing, 85

extensions, 244

HTTP remoting channels, 271

IFormatter interface for, 84

overview, 70

serialization, 70, 8485

SoapFormatter class, 8485

Socket class. See also sockets

Accept method, 186187

AddressFamily parameter, 147

asynchronous methods, 192193

Begin methods, 192193

BeginReceive method, 198200

BeginSend method, 198

Bind method, 184

Blocking property, 165

byte arrays requirement, 157

Close method, 187

code access security, 181

connection information, 306

End methods, 192193

GetSocketOption method, 161164

HTTP with, 203

instantiating, 146147

IOControl method, 164165

Listen method, 184185

multicast options, 166169

network streams with, 35

OutOfBand flag, 155

parameters, 147

permissions for, 180, 303

ProtocolType parameter, 147

purpose of, 143

Receive methods, 157159

ReceiveBuffer option, 163164

Send methods, 154157

SetSocketOption method, 161164

Shutdown method, 159161

simplified classes based on, 178180

SocketExceptions, 147, 150151, 159

SocketFlags, 155, 157

SocketOptionLevel, 161

SocketOptionName, 161163

SocketType parameter, 147

TcpClient class, 178179

TcpListener class, 179180

UdpClient class, 180

SocketPermission class, 188, 189192

sockets

accepting client connections, 186187

address object creation, 148149

asynchronous operation of, 192201

binding, 148151, 184

blocking mode, 156

byte arrays requirement, 157

byte order, 171172

checksums, 174178

class. See Socket class

classes for, .NET, 107112, 143

client. See client sockets

closing, 159161, 187

code access security for, 181, 302303

conditional accepts, 308

connections, 151153, 186187, 197

connections per server, limiting, 308

creating, 146147, 184185

defined, 146

displaying with netstat, 184

DNS permissions, 303

encryption with, 310311

endpoint creation, 149

exceptions, class for, 107, 147, 150151, 159

ExclusiveAddressUse option, 304305

graceful shutdowns, 159

HeaderIncluded option, 176177

host name resolution, 151153

HTTP with, 203

ICMP protocol, 172176

identifying connections and sessions, 306310

idle connection handling, 310

implicit binding problem, 321

ioctls, 164166

IPAddress class, 148149

IP_RECEIVE_BROADCAST option, 305306

listening. See server sockets

memory for, 327328

multicasting, 166170

multiple accept operations, 197

namespace for classes, 146

network interfaces with, 148

non-blocking mode, setting, 165166

option methods, 161164

options, security, 304306

OutOfBand flag, 155

Parse method for addresses, 148149

peer determination, 308310

permissions, 107, 180, 189192, 303

port numbers , 149151

protocol headers, 171172

protocol selection, 147

raw, 170177

ReceiveBuffer option, 163164

receiving data, 157159, 172176

ReuseAddress option, 304305

security for, 188192, 302311

sending data, 154157, 171172

server. See server sockets

session identification, 306310

shares, 304

sharing ports, 188189

SimpleSocket sample, 146

simplified classes, 178180

Socket class. See Socket class

SocketExceptions, 107, 147, 150151, 159

SocketFlags, 155, 157

SocketOptionLevel, 161

SocketOptionName, 161163

SocketType parameter, 147

TCP vs. UDP connections, 151

TcpClient class, 178179

TcpListener class, 179180

transport protocols, 144

UdpClient class, 180

Web page download example, 107111

wildcard address, 188189

spoofing attacks, 303

SSL (Secure Sockets Layer)

HTTP using, 234, 316

overview, 316

stream for, 40

Web services with, 257

stack, .NET Framework, 4

static IP addresses, 125

Stream class, 2526

Stream pattern, 17

StreamReader class, 4344

streams

asynchronous, 27

backing stores for, 23

base streams, 2425, 27

BeginRead method, 25

BeginWrite method, 25

BinaryWriter class, 45

blocking, problems with, 47

BufferedStream class, 40

buffering, 32

byte-type arrays for, 26

CanRead property, 26

CanSeek property, 26

CanWrite property, 26

character-based data with, 4344

character sets, table of types, 4344

Close method, 25, 33, 34, 37

composable , 2425, 3943

CryptoStream class, 4043

EndRead method, 26

EndWrite method, 26

file streams, 2733

Flush method, 26

HttpWebResponse, returning from, 207

IO namespace, 8

Length property, 26

memory streams, 3334

methods available to, table of, 2526

network streams, 3539, 6365, 111

NotSupportedException, 25

Position property, 26, 3031

process diagram, 23

properties of, 26

purpose of, 17, 23

Read method, 26, 3132, 44

ReadByte method, 26

readers, 4345

ReadLine method, 44

ReadToEnd method, 44

Seek method, 26, 30

serial base streams, 27

SetLength method, 26

SSL, 40

Stream class, 2526

Stream pattern, 17

StreamReader class, 4344

StreamWriter class, 4344

synchronous, 27

TcpClient NetworkStreams, 179

TextWriter class, 44

types of, 2425

Write method, 26, 44

WriteByte, 26

WriteLine method, 44

writers, 4345

writing data to files, 2930

writing to memory streams, 34

StreamWriter class, 4344

System namespace

defined, 7

second-level namespaces, table of, 810

System.Management classes, 339342

System.Net

accessing existing protocols, 122

application protocols layer, 102, 112116

basic network types and services layer, 102106

defined, 101

Dns class, 106, 133140

Endpoint class, 104

extending higher layers of stacks, 123

file URI support, 116

HTTP connection management, 115

HTTP error handling classes, 115

IPAddress class, 103104

IPEndpoint type, 104

layers of, 101102

.NET Remoting, compared to, 123

NetworkCredential class, 104105

NetworkStream class, 111

non-IP protocols, addressing, 104

non-provided protocols, implementing, 122123

NTP with, 122

request-response layer, 102, 116121

scenarios for use, 121123

Service classes, 115

socket-level helper classes, 111112

socket-level layer, 102, 107112

Web services, compared to, 123

WebClient class, 119121

WebException class, 115

WebPermission class, 119

System.Net.Socket. See Socket class; sockets

System.Uri class, 9098

Категории