本文整理汇总了C#中System.Net.BufferOffsetSize类的典型用法代码示例。如果您正苦于以下问题:C# BufferOffsetSize类的具体用法?C# BufferOffsetSize怎么用?C# BufferOffsetSize使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BufferOffsetSize类属于System.Net命名空间,在下文中一共展示了BufferOffsetSize类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SplitWritesState
internal SplitWritesState(BufferOffsetSize[] buffers)
{
this._UserBuffers = buffers;
this._LastBufferConsumed = 0;
this._Index = 0;
this._RealBuffers = null;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:SplitWritesState.cs
示例2: BeginMultipleWrite
internal override IAsyncResult BeginMultipleWrite(BufferOffsetSize[] buffers, AsyncCallback callback, object state)
{
IAsyncResult result2;
if (!this.m_Worker.IsAuthenticated)
{
BufferAsyncResult result = new BufferAsyncResult(this, buffers, state, callback);
if (this.ProcessAuthentication(result))
{
return result;
}
}
try
{
result2 = this.m_Worker.SecureStream.BeginWrite(buffers, callback, state);
}
catch
{
if (this.m_Worker.IsCertValidationFailed)
{
this.m_ExceptionStatus = WebExceptionStatus.TrustFailure;
}
else if (this.m_Worker.LastSecurityStatus != SecurityStatus.OK)
{
this.m_ExceptionStatus = WebExceptionStatus.SecureChannelFailure;
}
else
{
this.m_ExceptionStatus = WebExceptionStatus.SendFailure;
}
throw;
}
return result2;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:TlsStream.cs
示例3: BeginWrite
internal IAsyncResult BeginWrite(BufferOffsetSize[] buffers, AsyncCallback asyncCallback, object asyncState)
{
LazyAsyncResult userAsyncResult = new LazyAsyncResult(this, asyncState, asyncCallback);
SplitWriteAsyncProtocolRequest asyncRequest = new SplitWriteAsyncProtocolRequest(userAsyncResult);
this.ProcessWrite(buffers, asyncRequest);
return userAsyncResult;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:_SslStream.cs
示例4: NestedMultipleAsyncResult
internal NestedMultipleAsyncResult(object asyncObject, object asyncState, AsyncCallback asyncCallback, BufferOffsetSize[] buffers) : base(asyncObject, asyncState, asyncCallback)
{
this.Buffers = buffers;
this.Size = 0;
for (int i = 0; i < this.Buffers.Length; i++)
{
this.Size += this.Buffers[i].Size;
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:NestedMultipleAsyncResult.cs
示例5: GetBuffers
internal BufferOffsetSize[] GetBuffers()
{
if (this.Empty)
{
return null;
}
BufferOffsetSize[] sizeArray = new BufferOffsetSize[this.chunkCount];
int index = 0;
for (MemoryChunk chunk = this.headChunk; chunk != null; chunk = chunk.Next)
{
sizeArray[index] = new BufferOffsetSize(chunk.Buffer, 0, chunk.FreeOffset, false);
index++;
}
return sizeArray;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:ScatterGatherBuffers.cs
示例6: SetUnmanagedStructures
internal void SetUnmanagedStructures(BufferOffsetSize[] buffers)
{
this.m_WSABuffers = new WSABuffer[buffers.Length];
object[] objectsToPin = new object[buffers.Length];
for (int i = 0; i < buffers.Length; i++)
{
objectsToPin[i] = buffers[i].Buffer;
}
base.SetUnmanagedStructures(objectsToPin);
for (int j = 0; j < buffers.Length; j++)
{
this.m_WSABuffers[j].Length = buffers[j].Size;
this.m_WSABuffers[j].Pointer = Marshal.UnsafeAddrOfPinnedArrayElement(buffers[j].Buffer, buffers[j].Offset);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:OverlappedAsyncResult.cs
示例7: GetBuffers
public BufferOffsetSize[] GetBuffers() {
if (Empty) {
return null;
}
GlobalLog.Print("ScatterGatherBuffers#" + ValidationHelper.HashString(this) + "::ToArray() chunkCount:" + chunkCount.ToString());
BufferOffsetSize[] array = new BufferOffsetSize[chunkCount];
int index = 0;
MemoryChunk thisMemoryChunk = headChunk;
while (thisMemoryChunk!=null) {
GlobalLog.Print("ScatterGatherBuffers#" + ValidationHelper.HashString(this) + "::ToArray() index:" + index.ToString() + " size:" + thisMemoryChunk.FreeOffset);
//
// buffer itself is referenced by the BufferOffsetSize struct, data is not copied
//
array[index] = new BufferOffsetSize(thisMemoryChunk.Buffer, 0, thisMemoryChunk.FreeOffset, false);
index++;
thisMemoryChunk = thisMemoryChunk.Next;
}
return array;
}
开发者ID:ArildF,项目名称:masters,代码行数:19,代码来源:_scattergatherbuffers.cs
示例8: SetUnmanagedStructures
internal void SetUnmanagedStructures(BufferOffsetSize[] buffers)
{
// Fill in Buffer Array structure that will be used for our send/recv Buffer
_wsaBuffers = new WSABuffer[buffers.Length];
object[] objectsToPin = new object[buffers.Length];
for (int i = 0; i < buffers.Length; i++)
{
objectsToPin[i] = buffers[i].Buffer;
}
// has to be called now to pin memory
base.SetUnmanagedStructures(objectsToPin);
for (int i = 0; i < buffers.Length; i++)
{
_wsaBuffers[i].Length = buffers[i].Size;
_wsaBuffers[i].Pointer = Marshal.UnsafeAddrOfPinnedArrayElement(buffers[i].Buffer, buffers[i].Offset);
}
}
开发者ID:nnyamhon,项目名称:corefx,代码行数:20,代码来源:_OverlappedAsyncResult.Windows.cs
示例9: MultipleSend
internal void MultipleSend(BufferOffsetSize[] buffers, SocketFlags socketFlags) {
if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "MultipleSend", "");
if (CleanedUp) {
throw new ObjectDisposedException(this.GetType().FullName);
}
//
// parameter validation
//
GlobalLog.Assert(buffers != null, "Socket#{0}::MultipleSend()|buffers == null", ValidationHelper.HashString(this));
GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::MultipleSend() buffers.Length:" + buffers.Length.ToString());
WSABuffer[] WSABuffers = new WSABuffer[buffers.Length];
GCHandle[] objectsToPin = null;
int bytesTransferred;
SocketError errorCode;
try {
objectsToPin = new GCHandle[buffers.Length];
for (int i = 0; i < buffers.Length; ++i)
{
objectsToPin[i] = GCHandle.Alloc(buffers[i].Buffer, GCHandleType.Pinned);
WSABuffers[i].Length = buffers[i].Size;
WSABuffers[i].Pointer = Marshal.UnsafeAddrOfPinnedArrayElement(buffers[i].Buffer, buffers[i].Offset);
}
// This can throw ObjectDisposedException.
errorCode = UnsafeNclNativeMethods.OSSOCK.WSASend_Blocking(
m_Handle.DangerousGetHandle(),
WSABuffers,
WSABuffers.Length,
out bytesTransferred,
socketFlags,
SafeNativeOverlapped.Zero,
IntPtr.Zero);
GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::MultipleSend() UnsafeNclNativeMethods.OSSOCK.WSASend returns:" + errorCode.ToString() + " size:" + buffers.Length.ToString());
}
finally {
if (objectsToPin != null)
for (int i = 0; i < objectsToPin.Length; ++i)
if (objectsToPin[i].IsAllocated)
objectsToPin[i].Free();
}
if (errorCode!=SocketError.Success) {
SocketException socketException = new SocketException();
UpdateStatusAfterSocketError(socketException);
if(s_LoggingEnabled)Logging.Exception(Logging.Sockets, this, "MultipleSend", socketException);
throw socketException;
}
if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "MultipleSend", "");
}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:54,代码来源:Socket.cs
示例10: BeginWriteMessage
//
//
//
//
public IAsyncResult BeginWriteMessage(byte[] message, AsyncCallback asyncCallback, object stateObject) {
if (message == null) {
throw new ArgumentNullException("message");
}
m_WriteHeader.PayloadSize = message.Length;
m_WriteHeader.CopyTo(m_WriteHeaderBuffer, 0);
if (m_NetworkStream != null && message.Length != 0) {
BufferOffsetSize[] buffers = new BufferOffsetSize[2];
buffers[0] = new BufferOffsetSize(m_WriteHeaderBuffer, 0, m_WriteHeaderBuffer.Length, false);
buffers[1] = new BufferOffsetSize(message, 0, message.Length, false);
return m_NetworkStream.BeginMultipleWrite(buffers, asyncCallback, stateObject);
}
if (message.Length == 0) {
return Transport.BeginWrite(m_WriteHeaderBuffer, 0, m_WriteHeaderBuffer.Length,
asyncCallback, stateObject);
}
//Will need two async writes
// Prepare the second
WorkerAsyncResult workerResult = new WorkerAsyncResult(this, stateObject, asyncCallback,
message, 0, message.Length);
// Charge the first
IAsyncResult result = Transport.BeginWrite(m_WriteHeaderBuffer, 0, m_WriteHeaderBuffer.Length,
m_BeginWriteCallback, workerResult);
if (result.CompletedSynchronously)
{
BeginWriteComplete(result);
}
return workerResult;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:37,代码来源:_StreamFramer.cs
示例11: WriteMessage
//
//
//
//
public void WriteMessage(byte[] message) {
if (message == null) {
throw new ArgumentNullException("message");
}
m_WriteHeader.PayloadSize = message.Length;
m_WriteHeader.CopyTo(m_WriteHeaderBuffer, 0);
if (m_NetworkStream != null && message.Length != 0) {
BufferOffsetSize[] buffers = new BufferOffsetSize[2];
buffers[0] = new BufferOffsetSize(m_WriteHeaderBuffer, 0, m_WriteHeaderBuffer.Length, false);
buffers[1] = new BufferOffsetSize(message, 0, message.Length, false);
m_NetworkStream.MultipleWrite(buffers);
}
else {
Transport.Write(m_WriteHeaderBuffer, 0, m_WriteHeaderBuffer.Length);
if (message.Length==0) {
return;
}
Transport.Write(message, 0, message.Length);
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:25,代码来源:_StreamFramer.cs
示例12: UnsafeBeginMultipleWrite
internal override IAsyncResult UnsafeBeginMultipleWrite(BufferOffsetSize[] buffers, AsyncCallback callback, object state) {
return BeginMultipleWrite(buffers,callback,state);
}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:3,代码来源:_TLSstream.cs
示例13: MultipleSend
internal void MultipleSend(BufferOffsetSize[] buffers, SocketFlags socketFlags)
{
if (Socket.s_LoggingEnabled)
Logging.Enter(Logging.Sockets, (object) this, "MultipleSend", "");
if (this.CleanedUp)
throw new ObjectDisposedException(this.GetType().FullName);
WSABuffer[] buffersArray = new WSABuffer[buffers.Length];
GCHandle[] gcHandleArray = (GCHandle[]) null;
SocketError socketError;
try
{
gcHandleArray = new GCHandle[buffers.Length];
for (int index = 0; index < buffers.Length; ++index)
{
gcHandleArray[index] = GCHandle.Alloc((object) buffers[index].Buffer, GCHandleType.Pinned);
buffersArray[index].Length = buffers[index].Size;
buffersArray[index].Pointer = Marshal.UnsafeAddrOfPinnedArrayElement((Array) buffers[index].Buffer, buffers[index].Offset);
}
int bytesTransferred;
socketError = UnsafeNclNativeMethods.OSSOCK.WSASend_Blocking(this.m_Handle.DangerousGetHandle(), buffersArray, buffersArray.Length, out bytesTransferred, socketFlags, (SafeHandle) SafeNativeOverlapped.Zero, IntPtr.Zero);
}
finally
{
if (gcHandleArray != null)
{
for (int index = 0; index < gcHandleArray.Length; ++index)
{
if (gcHandleArray[index].IsAllocated)
gcHandleArray[index].Free();
}
}
}
if (socketError != SocketError.Success)
{
SocketException socketException = new SocketException();
this.UpdateStatusAfterSocketError(socketException);
if (Socket.s_LoggingEnabled)
Logging.Exception(Logging.Sockets, (object) this, "MultipleSend", (Exception) socketException);
throw socketException;
}
else
{
if (!Socket.s_LoggingEnabled)
return;
Logging.Exit(Logging.Sockets, (object) this, "MultipleSend", "");
}
}
开发者ID:korifey,项目名称:hackathon-Ideaphone,代码行数:47,代码来源:Socket.cs
示例14: SendAsync
public static SocketError SendAsync(SafeCloseSocket handle, BufferOffsetSize[] buffers, SocketFlags socketFlags, OverlappedAsyncResult asyncResult)
{
return handle.AsyncContext.SendAsync(new BufferList(buffers), GetPlatformSocketFlags(socketFlags), asyncResult.CompletionCallback);
}
开发者ID:nnyamhon,项目名称:corefx,代码行数:4,代码来源:SocketPal.Unix.cs
示例15: DoBeginMultipleSend
private void DoBeginMultipleSend(BufferOffsetSize[] buffers, SocketFlags socketFlags, OverlappedAsyncResult asyncResult)
{
if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "BeginMultipleSend", "");
if (CleanedUp) {
throw new ObjectDisposedException(this.GetType().FullName);
}
//
// parameter validation
//
GlobalLog.Assert(buffers != null, "Socket#{0}::DoBeginMultipleSend()|buffers == null", ValidationHelper.HashString(this));
GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::DoBeginMultipleSend() buffers.Length:" + buffers.Length.ToString());
// Guarantee to call CheckAsyncCallOverlappedResult if we call SetUnamangedStructures with a cache in order to
// avoid a Socket leak in case of error.
SocketError errorCode = SocketError.SocketError;
try
{
// Set up asyncResult for overlapped WSASend.
// This call will use completion ports on WinNT and Overlapped IO on Win9x.
asyncResult.SetUnmanagedStructures(buffers, ref Caches.SendOverlappedCache);
// This can throw ObjectDisposedException.
int bytesTransferred;
errorCode = UnsafeNclNativeMethods.OSSOCK.WSASend(
m_Handle,
asyncResult.m_WSABuffers,
asyncResult.m_WSABuffers.Length,
out bytesTransferred,
socketFlags,
asyncResult.OverlappedHandle,
IntPtr.Zero);
if (errorCode!=SocketError.Success) {
errorCode = (SocketError)Marshal.GetLastWin32Error();
}
GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::BeginMultipleSend() UnsafeNclNativeMethods.OSSOCK.WSASend returns:" + errorCode.ToString() + " size:" + buffers.Length.ToString() + " returning AsyncResult:" + ValidationHelper.HashString(asyncResult));
}
finally
{
errorCode = asyncResult.CheckAsyncCallOverlappedResult(errorCode);
}
//
// if the asynchronous native call fails synchronously
// we'll throw a SocketException
//
if (errorCode!=SocketError.Success) {
//
// update our internal state after this socket error and throw
//
asyncResult.ExtractCache(ref Caches.SendOverlappedCache);
SocketException socketException = new SocketException(errorCode);
UpdateStatusAfterSocketError(socketException);
if(s_LoggingEnabled)Logging.Exception(Logging.Sockets, this, "BeginMultipleSend", socketException);
throw socketException;
}
if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "BeginMultipleSend", asyncResult);
}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:58,代码来源:Socket.cs
示例16: ResubmitWrite
/*++
Uses an old Stream to resubmit buffered data using the current
stream, this is used in cases of POST, or authentication,
where we need to buffer upload data so that it can be resubmitted
Input:
OldStream - Old Stream that was previously used
Returns:
Nothing.
--*/
//
internal void ResubmitWrite(ConnectStream oldStream, bool suppressWrite) {
GlobalLog.Enter("ConnectStream#" + ValidationHelper.HashString(this) + "::ResubmitWrite", ValidationHelper.HashString(oldStream));
GlobalLog.ThreadContract(ThreadKinds.Sync, "ConnectStream#" + ValidationHelper.HashString(this) + "::ResubmitWrite");
//
//
//
// we're going to resubmit
//
try {
Interlocked.CompareExchange(ref m_CallNesting, Nesting.InternalIO, Nesting.Idle);
GlobalLog.Print("ConnectStream#" + ValidationHelper.HashString(this) + "::ResubmitWrite() Inc: " + m_CallNesting.ToString());
GlobalLog.Print("ConnectStream#" + ValidationHelper.HashString(this) + "::ResubmitWrite(), callNesting : " + m_CallNesting.ToString() + " IsClosed = " + IsClosed);
//
// no need to buffer here:
// we're already resubmitting buffered data give it to the connection to put it on the wire again
// we set BytesLeftToWrite to 0 'cause even on failure there can be no recovery,
// so just leave it to IOError() to clean up and don't call ResubmitWrite()
//
ScatterGatherBuffers bufferedData = oldStream.BufferedData;
SafeSetSocketTimeout(SocketShutdown.Send);
if (!WriteChunked) {
if (!suppressWrite)
m_Connection.Write(bufferedData);
}
else {
// we have the data buffered, but we still want to chunk.
// first set this to disable Close() from sending a chunk terminator.
GlobalLog.Assert(m_HttpWriteMode != HttpWriteMode.None, "ConnectStream#{0}::ResubmitWrite()|m_HttpWriteMode == HttpWriteMode.None", ValidationHelper.HashString(this));
m_HttpWriteMode = HttpWriteMode.ContentLength;
if (bufferedData.Length==0) {
m_Connection.Write(NclConstants.ChunkTerminator, 0, NclConstants.ChunkTerminator.Length);
}
else {
int chunkHeaderOffset = 0;
byte[] chunkHeaderBuffer = GetChunkHeader(bufferedData.Length, out chunkHeaderOffset);
BufferOffsetSize[] dataBuffers = bufferedData.GetBuffers();
BufferOffsetSize[] buffers = new BufferOffsetSize[dataBuffers.Length + 3];
buffers[0] = new BufferOffsetSize(chunkHeaderBuffer, chunkHeaderOffset, chunkHeaderBuffer.Length - chunkHeaderOffset, false);
int index = 0;
foreach (BufferOffsetSize buffer in dataBuffers) {
buffers[++index] = buffer;
}
buffers[++index] = new BufferOffsetSize(NclConstants.CRLF, 0, NclConstants.CRLF.Length, false);
buffers[++index] = new BufferOffsetSize(NclConstants.ChunkTerminator, 0, NclConstants.ChunkTerminator.Length, false);
SplitWritesState splitState = new SplitWritesState(buffers);
BufferOffsetSize[] sendBuffers = splitState.GetNextBuffers();
while(sendBuffers != null){
m_Connection.MultipleWrite(sendBuffers);
sendBuffers = splitState.GetNextBuffers();
}
}
}
if(Logging.On && bufferedData.GetBuffers() != null) {
foreach (BufferOffsetSize bufferOffsetSize in bufferedData.GetBuffers()) {
if (bufferOffsetSize == null) {
Logging.Dump(Logging.Web, this, "ResubmitWrite", null, 0, 0);
}
else {
Logging.Dump(Logging.Web, this, "ResubmitWrite", bufferOffsetSize.Buffer, bufferOffsetSize.Offset, bufferOffsetSize.Size);
}
}
}
GlobalLog.Print("ConnectStream#" + ValidationHelper.HashString(this) + "::ResubmitWrite() sent:" + bufferedData.Length.ToString() );
}
catch (Exception exception)
{
if (NclUtilities.IsFatal(exception)) throw;
// A Fatal error
WebException we = new WebException(NetRes.GetWebStatusString("net_connclosed", WebExceptionStatus.SendFailure),
WebExceptionStatus.SendFailure,
WebExceptionInternalStatus.RequestFatal,
exception);
IOError(we, false);
//.........这里部分代码省略.........
开发者ID:uQr,项目名称:referencesource,代码行数:101,代码来源:_ConnectStream.cs
示例17: DoBeginMultipleSend
private void DoBeginMultipleSend(BufferOffsetSize[] buffers, SocketFlags socketFlags, OverlappedAsyncResult asyncResult)
{
if (s_loggingEnabled)
{
Logging.Enter(Logging.Sockets, this, "BeginMultipleSend", "");
}
if (CleanedUp)
{
throw new ObjectDisposedException(this.GetType().FullName);
}
// Validate input parameters.
GlobalLog.Assert(buffers != null, "Socket#{0}::DoBeginMultipleSend()|buffers == null", Logging.HashString(this));
GlobalLog.Print("Socket#" + Logging.HashString(this) + "::DoBeginMultipleSend() buffers.Length:" + buffers.Length.ToString());
// Guarantee to call CheckAsyncCallOverlappedResult if we call SetUnamangedStructures with a cache in order to
// avoid a Socket leak in case of error.
SocketError errorCode = SocketError.SocketError;
try
{
errorCode = SocketPal.SendAsync(_handle, buffers, socketFlags, asyncResult);
GlobalLog.Print("Socket#" + Logging.HashString(this) + "::BeginMultipleSend() Interop.Winsock.WSASend returns:" + errorCode.ToString() + " size:" + buffers.Length.ToString() + " returning AsyncResult:" + Logging.HashString(asyncResult));
}
finally
{
errorCode = asyncResult.CheckAsyncCallOverlappedResult(errorCode);
}
// Throw an appropriate SocketException if the native call fails synchronously.
if (errorCode != SocketError.Success)
{
// Update the internal state of this socket according to the error before throwing.
SocketException socketException = new SocketException((int)errorCode);
UpdateStatusAfterSocketError(socketException);
if (s_loggingEnabled)
{
Logging.Exception(Logging.Sockets, this, "BeginMultipleSend", socketException);
}
throw socketException;
}
if (s_loggingEnabled)
{
Logging.Exit(Logging.Sockets, this, "BeginMultipleSend", asyncResult);
}
}
开发者ID:hitomi333,项目名称:corefx,代码行数:45,代码来源:Socket.cs
示例18: MultipleSend
internal void MultipleSend(BufferOffsetSize[] buffers, SocketFlags socketFlags)
{
if (s_loggingEnabled)
{
Logging.Enter(Logging.Sockets, this, "MultipleSend", "");
}
if (CleanedUp)
{
throw new ObjectDisposedException(this.GetType().FullName);
}
// Validate input parameters.
GlobalLog.Assert(buffers != null, "Socket#{0}::MultipleSend()|buffers == null", Logging.HashString(this));
GlobalLog.Print("Socket#" + Logging.HashString(this) + "::MultipleSend() buffers.Length:" + buffers.Length.ToString());
int bytesTransferred;
SocketError errorCode = SocketPal.Send(_handle, buffers, socketFlags, out bytesTransferred);
GlobalLog.Print("Socket#" + Logging.HashString(this) + "::MultipleSend() Interop.Winsock.WSASend returns:" + errorCode.ToString() + " size:" + buffers.Length.ToString());
if (errorCode != SocketError.Success)
{
SocketException socketException = new SocketException((int)SocketPal.GetLastSocketError());
UpdateStatusAfterSocketError(socketException);
if (s_loggingEnabled)
{
Logging.Exception(Logging.Sockets, this, "MultipleSend", socketException);
}
throw socketException;
}
if (s_loggingEnabled)
{
Logging.Exit(Logging.Sockets, this, "MultipleSend", "");
}
}
开发者ID:hitomi333,项目名称:corefx,代码行数:36,代码来源:Socket.cs
示例19: BeginMultipleSend
internal IAsyncResult BeginMultipleSend(
BufferOffsetSize[] buffers,
SocketFlags socketFlags,
AsyncCallback callback,
Object state) {
//
// parameter validation
//
GlobalLog.Assert(buffers!=null, "Socket:BeginMultipleSend(): buffers==null", "");
GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::BeginMultipleSend() buffers.Length:" + buffers.Length.ToString());
//
// Allocate the async result and the event we'll pass to the
// thread pool.
//
OverlappedAsyncResult asyncResult =
new OverlappedAsyncResult(
this,
state,
callback );
//
// Set up asyncResult for overlapped WSASend.
// This call will use
// completion ports on WinNT and Overlapped IO on Win9x.
//
asyncResult.SetUnmanagedStructures(
buffers,
socketFlags);
//
// Get the Send going.
//
int errorCode =
UnsafeNclNativeMethods.OSSOCK.WSASend(
m_Handle,
asyncResult.m_WSABuffers,
asyncResult.m_WSABuffers.Length,
OverlappedAsyncResult.m_BytesTransferred,
asyncResult.m_Flags,
asyncResult.IntOverlapped,
IntPtr.Zero );
if (errorCode!=SocketErrors.Success) {
errorCode = Marshal.GetLastWin32Error();
}
asyncResult.CheckAsyncCallOverlappedResult(errorCode);
GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::BeginMultipleSend() UnsafeNclNativeMethods.OSSOCK.WSASend returns:" + errorCode.ToString() + " size:" + buffers.Length.ToString() + " returning AsyncResult:" + ValidationHelper.HashString(asyncResult));
//
// if the asynchronous native call fails synchronously
// we'll throw a SocketException
//
if (asyncResult.ErrorCode!=SocketErrors.Success) {
//
// update our internal state after this socket error and throw
//
UpdateStatusAfterSocketError();
throw new SocketException(asyncResult.ErrorCode);
}
return asyncResult;
}
开发者ID:ArildF,项目名称:masters,代码行数:67,代码来源:socket.cs
示例20: BufferAsyncResult
// MultipleWriteOnly
//
public BufferAsyncResult(object asyncObject, BufferOffsetSize[] buffers, object asyncState, AsyncCallback asyncCallback)
:base (asyncObject, asyncState, asyncCallback)
{
Buffers = buffers;
IsWrite = true;
}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:8,代码来源:_HelperAsyncResults.cs
注:本文中的System.Net.BufferOffsetSize类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论