با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
پس از برقراری ارتباط بین دستگاهها، میتوانید تبادل داده را آغاز کنید. داده های مبادله شده می توانند به شکل یک آرایه بایتی ساده مانند یک پیام متنی کوتاه باشند. یک فایل، مانند عکس یا ویدیو؛ یا یک جریان، مانند پخش جریانی صدا از میکروفون دستگاه.
داده ها را می توان با استفاده از روش های مثال مدیر اتصال زیر ارسال کرد:
send(_:to:)
startStream(_:to:)
sendResource(at:withName:to:)
هنگام دریافت داده ها می توان از روش های واگذاری مدیر اتصال زیر استفاده کرد.
سویفت
extensionExample:ConnectionManagerDelegate{funcconnectionManager(_connectionManager:ConnectionManager,didReceivedata:Data,withIDpayloadID:PayloadID,fromendpointID:EndpointID){// A simple byte payload has been received. This will always include the full data.}funcconnectionManager(_connectionManager:ConnectionManager,didReceivestream:InputStream,withIDpayloadID:PayloadID,fromendpointID:EndpointID,cancellationTokentoken:CancellationToken){// We have received a readable stream.}funcconnectionManager(_connectionManager:ConnectionManager,didStartReceivingResourceWithIDpayloadID:PayloadID,fromendpointID:EndpointID,atlocalURL:URL,withNamename:String,cancellationTokentoken:CancellationToken){// We have started receiving a file. We will receive a separate transfer update// event when complete.}funcconnectionManager(_connectionManager:ConnectionManager,didReceiveTransferUpdateupdate:TransferUpdate,fromendpointID:EndpointID,forPayloadpayloadID:PayloadID){// A success, failure, cancelation or progress update.}}
تاریخ آخرین بهروزرسانی 2024-11-13 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2024-11-13 بهوقت ساعت هماهنگ جهانی."],[[["After establishing connections between devices, data exchange can commence, encompassing various formats like byte arrays, files, or streams."],["`ConnectionManager` offers methods such as `send(_:to:)`, `startStream(_:to:)`, and `sendResource(at:withName:to:)` for initiating data transmission."],["To receive data, implement the `ConnectionManagerDelegate` protocol, providing methods to handle byte payloads, streams, file transfers, and transfer updates."],["While payloads of the same type maintain their sending order upon arrival, there's no guarantee of order preservation across different payload types."]]],[]]