忍者ブログ
  • 2019.04
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 2019.06
重複して始まらないBeginAcceptTcpClient
EndAcceptTcpClientごとにスレッドが作成されるのかと思ったら、1スレッドしか作成できないらしい。何のための非同期なんだろう。。。1つ目のTcpClient作成後に、別の要求があっても2つ目のスレッドは作成されないで1つ目のTcpClientが終了するまでコールバックが呼ばれない。。。うむむ。
Public Sub run()

  Dim socks As clsSocket() = New clsSocket(1) {}
  Dim waits As Threading.WaitHandle() = New Threading.WaitHandle(socks.Length - 1) {}
  Debug.Print(Threading.Thread.CurrentThread.ManagedThreadId)
  mServer.Start(socks.Length - 1)
  Do
    For i As Integer = 0 To socks.Length - 1
      Dim wrkIdx As Integer = i
      If waits(wrkIdx) Is Nothing Then

        socks(wrkIdx) = New clsSocket(mIGetMessage)
        waits(wrkIdx) = mServer.BeginAcceptTcpClient(Sub(aISyncResult As IAsyncResult)

                                 Debug.Print(Threading.Thread.CurrentThread.ManagedThreadId)
                                 socks(wrkIdx).Begin(mServer.EndAcceptTcpClient(aISyncResult).GetStream())

                               End Sub, Nothing).AsyncWaitHandle

      End If
    Next

    waits(Threading.EventWaitHandle.WaitAny(waits)) = Nothing
  Loop

End Sub

PR
【2018/03/18 13:48 】 | javascript | 有り難いご意見(9)
                                    
<<重複して始まらないBeginAcceptTcpClient その2 | ホーム | CentOS7 + ibus>>
有り難いご意見
無題

このサンプルでは?

https://msdn.microsoft.com/ja-jp/library/system.net.sockets.tcplistener.endaccepttcpclient(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-2
【2018/03/20 20:00】| URL | ゼンガイチ #9b12d9711b [ 編集 ]


無題
最初と2つ目のスレッドIDだけが固有で、以降2つ目のスレッドIDが使われるため共有ロックになってしまいますね。。。
【2018/03/21 06:34】| | nwpfh #2aa3e25d1b [ 編集 ]


無題
Greetings fгom Ohio! I'm bored to tears ɑt worҝ so I decideԁ to browse your site on my iphߋne
during lunch breɑk. I really like the inco you pr᧐vidе heгe and can't wait to take
a look when I get home. I'm amazed aat how quісk your blog loaded on my cеⅼl phone
.. I'm not even using WIFI, juѕt 3G .. Anyhow, awesome site!
【2019/04/29 16:25】| URL | poker qq terpercaya #920682af6a [ 編集 ]


無題
That іs a great tiip especially to those new to the blоgosphere.
Simple but very accurate information… Many tһanks for sharing this one.

A must read post!
【2019/04/29 17:23】| URL | print kain denpasar #1aa152c29a [ 編集 ]


無題
This is reаlly іnteresting, You are a vеry skilled blogger.

I have joined your feed and look forward to ѕeeking more of youyr wonderful post.

Also, I've shared your site in mmy social networҝs!
【2019/04/29 18:00】| URL | skinov8.net #862371b8a6 [ 編集 ]


無題
Gгezt article! Wе will be linking to this great article
on our webѕіte. Keep uup thе grerat writing.
【2019/04/29 19:56】| URL | id card kulit jogja paling murah #8feb089f8a [ 編集 ]


無題
Тhis is a great tip particularly to thosе neԝ to the blogosphere.
Short but vеry accuratе іnfo… Thanks for sharing this one.
A must reɑd article!
【2019/04/29 21:36】| URL | id card kulit #1aa152c408 [ 編集 ]


無題
This desіgn is steller! Υou most certainly knkw how to keep a reader amused.
Вetween your wit and your videos, I was almost moved
to staft myy own blog (well, almost...HaHa!) Great
job. I reaⅼly loved what you had to saү, and more than that, how you presгnted
it. Tooo cool!
【2019/04/29 22:44】| URL | daftarbos #103a087d3e [ 編集 ]


無題
Gгezt article! Wе will be linking to this great article
on our webѕіte. Keep uup thе grerat writing.
【2019/04/30 01:50】| URL | id card kulit jogja paling murah #920dd86467 [ 編集 ]


貴重なご意見の投稿














<<前ページ | ホーム | 次ページ>>