Post

Replies

Boosts

Views

Activity

Reply to Network Name (local domain Name) of a Mac (Mac-OS)
No, i require the local domain assigned to a machine, just like we have in Windows. Hostname is used to identify a machine in network. I am able to get the hostname, how can i get FQDN (Fully Qualified Domain Name) which will be consisting of hostname.networkname for Ex - macofficestudio is my host name and thread.solutions.com is my network name (local domain name) so FQDN becomes macofficestudio.thread.solutions.com. How to get that ??
Topic: App & System Services SubTopic: Core OS Tags:
Apr ’24
Reply to Network Name (local domain Name) of a Mac (Mac-OS)
Yes It's related to Active Directory. Here I am not referring to the FQDN of the interfaces through which we are connected to Internet. Just like hostname which helps us to identify a machine in a network. We can use network-name (local domain name) which is assigned to a machine and doesn't depend on the interfaces, which can be used as an alternative of an IP-address. Fully Qualified Domain Name which i means is hostname + network name (local domain name) which can be used to communicate with a machine.
Topic: App & System Services SubTopic: Core OS Tags:
Apr ’24
Reply to How to create another instance of Data without copy
@Claude31 I can't use class type as this Data instance is provided to me by the OS whenever my Completion is been called w.r.t Receive. Now I want to use this data instance in C++. For which basically I create a wrapper class over this and pass it as Opaque to C++. Code Snippet class DataHolder { init () {} public var data_wrapper : Data? } func ReceiveHandler (_ pContent : Data? ) -> UnsafeMutablePointer { // pContent is only valid inside scope of this function . // Create a instance of wrapper class var x = DataHolder.init () // Copy being created here. x.data_wrapper = pContent return Unmanaged.passRetained (x).toOpaque () } Problem is copy creation each time which i want to prevent.
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’24
Reply to UnsafeMutablePointer direct exposure.
@DTS Engineer I got your point and i was able to use the pointer in that way. public func ReturnInteger() -> UnsafeMutablePointer<Int32> { withUnsafeMutablePointer(to: &value) {pointer in return pointer } } void CppClass::GetIntegerPointer() noexcept { int32_t * x = (int32_t *)Interop::ReturnInteger(); // The above way works but when i am trying to directly use // swift::UnsafeMutablePointer<int32_t> x = (int32_t *) Interop::ReturnInteger (); // it gives build error that UnsafeMutablePointer not found . } But in the documentation it's mentioned that it is exposed to C++. Quote Pointer types, like OpaquePointer, UnsafePointer, UnsafeMutablePointer, UnsafeRawPointer and UnsafeMutableRawPointer UnQuote Can you Explain what does this mean?
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’24
Reply to UnsafeMutablePointer direct exposure.
@DTS Engineer I know this that swift::Bool is compatible with c++ bool. What I wanted to ask is that in the documentation it is mentioned that Swift exposes UnsafeMutablePointer to C++ (link). Quote Pointer types, like OpaquePointer, UnsafePointer, UnsafeMutablePointer, UnsafeRawPointer and UnsafeMutableRawPointer UnQuote I directly want to use them in c++ as swift::UnsafeMutablePointer. If it's not true what documentation mean, then what is the manifestation for exposing these UnsafeMutablePointer?
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’24
Reply to Some fundamental doubts about DisptachQueue and GCD
Hi @DTS Engineer (Kevin), Concurrent queues are a relatively late addition to the API and, IMHO, are something that you should actively avoid, as they create exactly the same issues as the global concurrent queues.The ONE exception to that is cases where you're specifically trying to create a limited amount of parallel activity with a specific component ("up to 4 jobs at once"). IF that's the case, then the correct solution would be to use NSOperationQueue to set the width. As a side note here, NSOperationQueue is actually the API I would recommend over dispatch for case where you want something that works like GCD. It's built as a wrapper around dispatch, however, it also provides things like a common work object base class, cancellation, progress, etc. It also exports the underlying GCD queue, so you can also use it with any API that requires a GCD queue. As per your suggestion i tried using OperationQueue, which provide[s] us the capability of controlling the number of Concurrent Task[s] by specifying the maxConcurrentTask[s] property of the Operation Queue. To test this, I created an OperationQueue with QOS set to default and concurrent attributes to allow multiple tasks to run in parallel. I then set maxConcurrentOperationCount = 2 and passed the queue to the .start call of NWListener. Next, I sent 10 concurrent connections from another machine to observe whether only 2 connections would be processed at a time. However, despite setting maxConcurrentOperationCount, all 10 connections were handled simultaneously. It appears that the underlying dispatch queue is bypassing the concurrency limit. import Network import Foundation var operation_queue = OperationQueue () operation_queue.underlyingQueue = DispatchQueue (label: "test_operation_queue", qos: .default, attributes: .concurrent) operation_queue.maxConcurrentOperationCount = 2 do { var params = NWParameters(tls: NWProtocolTLS.Options (), tcp: NWProtocolTCP.Options()) let listener = try NWListener(using: params, on: 52000) // Use a specific port listener.stateUpdateHandler = { state in switch state { case .setup: print("Setup state") case .waiting(let error): print("Waiting state with error: \(error)") case .ready: print("Server is ready on port \(listener.port ?? 0)") case .failed(let error): print("Failed state with error: \(error)") case .cancelled: print("Cancelled state") @unknown default: print("Unknown state") } } listener.newConnectionHandler = {connection in print ("Connection Received and processing Started") } listener.start(queue: operation_queue.underlyingQueue!) } catch { print("Failed to create listener: \(error)") } Am I missing something here?
Feb ’25
Reply to Some fundamental doubts about DisptachQueue and GCD
Thanks, @DTS Engineer (Kevin). I think there's been a misunderstanding regarding my doubt about the OperationQueue concurrency limit. Since I’m using an OperationQueue with a defined concurrency limit, the number of tasks executing concurrently depends on this limit. As I am the one scheduling tasks through the OperationQueue, the concurrency level will be controlled by the set limit. Now, in the case of Apple's Network Framework, we need to provide a dispatch queue (The queue on which listener events are delivered). If I pass the same dispatch queue that the OperationQueue uses internally, will this affect the number of callbacks executed concurrently? Or does the OperationQueue concurrency limit have no impact on callback execution?
Feb ’25