• R/O
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

練習用です。いろんなものがごちゃまぜです。


Commit MetaInfo

Revision56 (tree)
Time2015-10-28 10:17:23
Authorbellyoshi

Log Message

Change Summary

Incremental Difference

--- Lianixi1/Lianixi1/Server/Program.cs (nonexistent)
+++ Lianixi1/Lianixi1/Server/Program.cs (revision 56)
@@ -0,0 +1,22 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Linq;
4+using System.Threading.Tasks;
5+using System.Windows.Forms;
6+
7+namespace Server
8+{
9+ static class Program
10+ {
11+ /// <summary>
12+ /// アプリケーションのメイン エントリ ポイントです。
13+ /// </summary>
14+ [STAThread]
15+ static void Main()
16+ {
17+ Application.EnableVisualStyles();
18+ Application.SetCompatibleTextRenderingDefault(false);
19+ Application.Run(new Form1());
20+ }
21+ }
22+}
--- Lianixi1/Lianixi1/Server/Properties/Resources.Designer.cs (nonexistent)
+++ Lianixi1/Lianixi1/Server/Properties/Resources.Designer.cs (revision 56)
@@ -0,0 +1,71 @@
1+//------------------------------------------------------------------------------
2+// <auto-generated>
3+// このコードはツールによって生成されました。
4+// ランタイム バージョン:4.0.30319.42000
5+//
6+// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
7+// コードが再生成されるときに損失したりします
8+// </auto-generated>
9+//------------------------------------------------------------------------------
10+
11+namespace Server.Properties
12+{
13+
14+
15+ /// <summary>
16+ /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。
17+ /// </summary>
18+ // このクラスは StronglyTypedResourceBuilder クラスが ResGen
19+ // または Visual Studio のようなツールを使用して自動生成されました。
20+ // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に
21+ // ResGen を実行し直すか、または VS プロジェクトをリビルドします。
22+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25+ internal class Resources
26+ {
27+
28+ private static global::System.Resources.ResourceManager resourceMan;
29+
30+ private static global::System.Globalization.CultureInfo resourceCulture;
31+
32+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33+ internal Resources()
34+ {
35+ }
36+
37+ /// <summary>
38+ /// このクラスで使用されるキャッシュされた ResourceManager インスタンスを返します。
39+ /// </summary>
40+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41+ internal static global::System.Resources.ResourceManager ResourceManager
42+ {
43+ get
44+ {
45+ if ((resourceMan == null))
46+ {
47+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Server.Properties.Resources", typeof(Resources).Assembly);
48+ resourceMan = temp;
49+ }
50+ return resourceMan;
51+ }
52+ }
53+
54+ /// <summary>
55+ /// 厳密に型指定されたこのリソース クラスを使用して、すべての検索リソースに対し、
56+ /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。
57+ /// </summary>
58+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59+ internal static global::System.Globalization.CultureInfo Culture
60+ {
61+ get
62+ {
63+ return resourceCulture;
64+ }
65+ set
66+ {
67+ resourceCulture = value;
68+ }
69+ }
70+ }
71+}
--- Lianixi1/Lianixi1/Server/Properties/AssemblyInfo.cs (nonexistent)
+++ Lianixi1/Lianixi1/Server/Properties/AssemblyInfo.cs (revision 56)
@@ -0,0 +1,36 @@
1+using System.Reflection;
2+using System.Runtime.CompilerServices;
3+using System.Runtime.InteropServices;
4+
5+// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
6+// アセンブリに関連付けられている情報を変更するには、
7+// これらの属性値を変更してください。
8+[assembly: AssemblyTitle("Server")]
9+[assembly: AssemblyDescription("")]
10+[assembly: AssemblyConfiguration("")]
11+[assembly: AssemblyCompany("")]
12+[assembly: AssemblyProduct("Server")]
13+[assembly: AssemblyCopyright("Copyright © 2015")]
14+[assembly: AssemblyTrademark("")]
15+[assembly: AssemblyCulture("")]
16+
17+// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
18+// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
19+// その型の ComVisible 属性を true に設定してください。
20+[assembly: ComVisible(false)]
21+
22+// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
23+[assembly: Guid("2b5681f6-0375-4f3c-8750-ccf9c6c93bdc")]
24+
25+// アセンブリのバージョン情報は次の 4 つの値で構成されています:
26+//
27+// メジャー バージョン
28+// マイナー バージョン
29+// ビルド番号
30+// Revision
31+//
32+// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
33+// 既定値にすることができます:
34+// [assembly: AssemblyVersion("1.0.*")]
35+[assembly: AssemblyVersion("1.0.0.0")]
36+[assembly: AssemblyFileVersion("1.0.0.0")]
--- Lianixi1/Lianixi1/Server/Properties/Settings.Designer.cs (nonexistent)
+++ Lianixi1/Lianixi1/Server/Properties/Settings.Designer.cs (revision 56)
@@ -0,0 +1,30 @@
1+//------------------------------------------------------------------------------
2+// <auto-generated>
3+// This code was generated by a tool.
4+// Runtime Version:4.0.30319.42000
5+//
6+// Changes to this file may cause incorrect behavior and will be lost if
7+// the code is regenerated.
8+// </auto-generated>
9+//------------------------------------------------------------------------------
10+
11+namespace Server.Properties
12+{
13+
14+
15+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18+ {
19+
20+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21+
22+ public static Settings Default
23+ {
24+ get
25+ {
26+ return defaultInstance;
27+ }
28+ }
29+ }
30+}
--- Lianixi1/Lianixi1/Server/Form1.Designer.cs (nonexistent)
+++ Lianixi1/Lianixi1/Server/Form1.Designer.cs (revision 56)
@@ -0,0 +1,85 @@
1+namespace Server
2+{
3+ partial class Form1
4+ {
5+ /// <summary>
6+ /// 必要なデザイナー変数です。
7+ /// </summary>
8+ private System.ComponentModel.IContainer components = null;
9+
10+ /// <summary>
11+ /// 使用中のリソースをすべてクリーンアップします。
12+ /// </summary>
13+ /// <param name="disposing">マネージ リソースを破棄する場合は true を指定し、その他の場合は false を指定します。</param>
14+ protected override void Dispose(bool disposing)
15+ {
16+ if (disposing && (components != null))
17+ {
18+ components.Dispose();
19+ }
20+ base.Dispose(disposing);
21+ }
22+
23+ #region Windows フォーム デザイナーで生成されたコード
24+
25+ /// <summary>
26+ /// デザイナー サポートに必要なメソッドです。このメソッドの内容を
27+ /// コード エディターで変更しないでください。
28+ /// </summary>
29+ private void InitializeComponent()
30+ {
31+ this.btn_start = new System.Windows.Forms.Button();
32+ this.btn_stop = new System.Windows.Forms.Button();
33+ this.rbox_show = new System.Windows.Forms.RichTextBox();
34+ this.SuspendLayout();
35+ //
36+ // btn_start
37+ //
38+ this.btn_start.Location = new System.Drawing.Point(34, 202);
39+ this.btn_start.Name = "btn_start";
40+ this.btn_start.Size = new System.Drawing.Size(75, 23);
41+ this.btn_start.TabIndex = 0;
42+ this.btn_start.Text = "スタート";
43+ this.btn_start.UseVisualStyleBackColor = true;
44+ this.btn_start.Click += new System.EventHandler(this.btn_start_Click);
45+ //
46+ // btn_stop
47+ //
48+ this.btn_stop.Location = new System.Drawing.Point(159, 202);
49+ this.btn_stop.Name = "btn_stop";
50+ this.btn_stop.Size = new System.Drawing.Size(75, 23);
51+ this.btn_stop.TabIndex = 0;
52+ this.btn_stop.Text = "ストップ";
53+ this.btn_stop.UseVisualStyleBackColor = true;
54+ this.btn_stop.Click += new System.EventHandler(this.btn_stop_Click);
55+ //
56+ // rbox_show
57+ //
58+ this.rbox_show.Location = new System.Drawing.Point(1, 1);
59+ this.rbox_show.Name = "rbox_show";
60+ this.rbox_show.Size = new System.Drawing.Size(280, 183);
61+ this.rbox_show.TabIndex = 1;
62+ this.rbox_show.Text = "";
63+ //
64+ // Form1
65+ //
66+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
67+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
68+ this.ClientSize = new System.Drawing.Size(282, 253);
69+ this.Controls.Add(this.rbox_show);
70+ this.Controls.Add(this.btn_stop);
71+ this.Controls.Add(this.btn_start);
72+ this.Name = "Form1";
73+ this.Text = "Form1";
74+ this.ResumeLayout(false);
75+
76+ }
77+
78+ #endregion
79+
80+ private System.Windows.Forms.Button btn_start;
81+ private System.Windows.Forms.Button btn_stop;
82+ private System.Windows.Forms.RichTextBox rbox_show;
83+ }
84+}
85+
--- Lianixi1/Lianixi1/Server/Form1.cs (nonexistent)
+++ Lianixi1/Lianixi1/Server/Form1.cs (revision 56)
@@ -0,0 +1,70 @@
1+using System;
2+using System.Windows.Forms;
3+using System.Net.Sockets;
4+using System.Threading;
5+
6+namespace Server
7+{
8+ public partial class Form1 : Form
9+ {
10+ private Socket mySock;
11+ private TcpListener tcpL;
12+ private NetworkStream netStream;
13+ private Thread tMain;
14+
15+ public Form1()
16+ {
17+ InitializeComponent();
18+ }
19+
20+ private void btn_start_Click(object sender, EventArgs e)
21+ {
22+ tcpL = new TcpListener(1888);
23+ tcpL.Start();
24+ rbox_show.AppendText("\r\n接続待ち......\r\n");
25+ tMain = new Thread(new ThreadStart(waitConnect));
26+ tMain.Start();
27+ }
28+ private void waitConnect()
29+ {
30+ while (true)
31+ {
32+ mySock = tcpL.AcceptSocket();
33+ if (mySock.Connected)
34+ {
35+ rbox_show.AppendText("接続しました。\r\n");//todo:ここでエラーになる。
36+ Thread t = new Thread(new ThreadStart(receive));
37+ t.IsBackground = true;
38+ t.Start();
39+ }
40+ }
41+ }
42+ private void receive()
43+ {
44+ while (true)
45+ {
46+ try
47+ {
48+ netStream = new NetworkStream(mySock);
49+ byte[] bb = new byte[1024];
50+ netStream.Read(bb, 0, bb.Length);
51+ string msgFromClient = System.Text.Encoding.UTF8.GetString(bb);
52+ rbox_show.AppendText(msgFromClient);
53+ }
54+ catch
55+ {
56+ //
57+ }
58+ }
59+ }
60+
61+ private void btn_stop_Click(object sender, EventArgs e)
62+ {
63+ netStream.Close();
64+ mySock.Close();
65+ tMain.Abort();
66+ tcpL.Stop();
67+ rbox_show.AppendText("\r\n停止しています。\r\n");
68+ }
69+ }
70+}