• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubybathyscaphegamewindowspythonphpguic翻訳omegattwitterframeworkbtronarduinovb.net計画中(planning stage)directxpreviewertestゲームエンジンdom

ソケットを使ってクライアントサーバプログラムを作成するための C# ライブラリ


Commit MetaInfo

Révision6761f0423826d43586f9ec058fc335892da5b5da (tree)
l'heure2015-08-23 12:38:19
Auteurtsntsumi <tsntsumi@tsnt...>
Commitertsntsumi

Message de Log

サンプルプロジェクト (UDPチャットアプリケーション) を追加

UdpServer を使用したチャットアプリケーションを追加した。
チャットアプリケーションの GUI は GTK# を使用して作成した。

Change Summary

Modification

--- /dev/null
+++ b/src/SocketNet/SampleUdpChatGtkClient/MainWindow.cs
@@ -0,0 +1,194 @@
1+//
2+// MainWindow.cs
3+//
4+// Author:
5+// tsntsumi <tsntsumi at tsntsumi.com>
6+//
7+// Copyright (c) 2015 tsntsumi
8+//
9+// This program is free software: you can redistribute it and/or modify
10+// it under the terms of the GNU Lesser General Public License as published by
11+// the Free Software Foundation, either version 3 of the License, or
12+// (at your option) any later version.
13+//
14+// This program is distributed in the hope that it will be useful,
15+// but WITHOUT ANY WARRANTY; without even the implied warranty of
16+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+// GNU Lesser General Public License for more details.
18+//
19+// You should have received a copy of the GNU Lesser General Public License
20+// along with this program. If not, see <http://www.gnu.org/licenses/>.
21+
22+/// @file
23+/// <summary>
24+/// GTK# ベースの簡単な UDP チャットクライアントのウィンドウを実装。
25+/// </summary>
26+/// @since 2015.8.23
27+using System;
28+using System.Text;
29+using System.Net;
30+using System.Net.Sockets;
31+using Gtk;
32+using SocketNet;
33+
34+/// <summary>
35+/// SocketNet ライブラリのサンプルプログラム (GTK# ベースの簡単な UDP チャットクライアント)。
36+/// </summary>
37+public partial class MainWindow: Gtk.Window
38+{
39+ UdpServer udpServer;
40+
41+ /// <summary>
42+ /// コンストラクタ。
43+ /// </summary>
44+ public MainWindow () : base(Gtk.WindowType.Toplevel)
45+ {
46+ Build();
47+ }
48+
49+ /// <summary>
50+ /// ウィンドウのデリートイベントを処理します。
51+ /// </summary>
52+ /// <param name="sender">センダ。</param>
53+ /// <param name="a">イベントデータを格納したオブジェクト。</param>
54+ protected void OnDeleteEvent(object sender, DeleteEventArgs a)
55+ {
56+ Application.Quit();
57+ a.RetVal = true;
58+ }
59+
60+ /// <summary>
61+ /// 受信開始ボタンがクリックされたときに、受信開始処理を行います。
62+ /// </summary>
63+ /// <param name="sender">センダ。</param>
64+ /// <param name="e">イベントデータを格納したオブジェクト。</param>
65+ protected void OnStartReceiveButtonClicked(object sender, EventArgs e)
66+ {
67+ try
68+ {
69+ int port = int.Parse(receivePortNoEntry.Text);
70+
71+ if (udpServer == null)
72+ {
73+ udpServer = UdpServer.CreateServer(port);
74+ udpServer.DataReceived += OnMessageReceived;
75+ }
76+ udpServer.Start();
77+ receivePortNoEntry.Sensitive = false;
78+ }
79+ catch (FormatException ex)
80+ {
81+ receiveTextView.Buffer.Text = ex.Message;
82+ }
83+ }
84+
85+ /// <summary>
86+ /// 受信停止ボタンがクリックされたときに、停止処理を行います。
87+ /// </summary>
88+ /// <param name="sender">センダ。</param>
89+ /// <param name="e">イベントデータを格納したオブジェクト。</param>
90+ protected void OnStopReceiveButtonClicked(object sender, EventArgs e)
91+ {
92+ if (udpServer != null)
93+ {
94+ udpServer.Stop();
95+ udpServer = null;
96+ }
97+ receivePortNoEntry.Sensitive = true;
98+ }
99+
100+ /// <summary>
101+ /// 送信ボタンをクリックされたときに、メッセージ入力エリアの文字列をサーバに送信します。
102+ /// </summary>
103+ /// <param name="sender">センダ。</param>
104+ /// <param name="e">イベントデータを格納したオブジェクト。</param>
105+ /// <remarks>
106+ /// UdpClient のインスタンスを作成するときに使用する送信先アドレスは、
107+ /// 固有アドレス、ブロードキャストアドレス、ローカルブロードキャストアドレスを指定することができる。
108+ /// </remarks>
109+ protected async void OnSendButtonClicked(object sender, EventArgs e)
110+ {
111+ try
112+ {
113+ int port = int.Parse(sendPortNoEntry.Text);
114+ Encoding encoding = new UTF8Encoding(false);
115+ byte[] data = encoding.GetBytes(messageEntry.Text);
116+ UdpClient udpClient = new UdpClient(sendAddressEntry.Text, port);
117+
118+ udpClient.EnableBroadcast = true;
119+ udpClient.DontFragment = true;
120+
121+ int result = await udpClient.SendAsync(data, data.Length);
122+ }
123+ catch (FormatException ex)
124+ {
125+ receiveTextView.Buffer.Text = ex.Message;
126+ }
127+ catch (Exception ex)
128+ {
129+ receiveTextView.Buffer.Text = ex.Message;
130+ }
131+ }
132+
133+ /// <summary>
134+ /// 受信ポート番号入力エリアが変更されたときに、開始/停止ボタンの有効化・無効化を行います。
135+ /// </summary>
136+ /// <param name="sender">センダ。</param>
137+ /// <param name="e">イベントデータを格納したオブジェクト。</param>
138+ protected void OnReceivePortNoEntryChanged(object sender, EventArgs e)
139+ {
140+ bool hasText = receivePortNoEntry.Text.Length > 0;
141+
142+ startReceiveButton.Sensitive = hasText;
143+ stopReceiveButton.Sensitive = hasText;
144+ }
145+
146+ /// <summary>
147+ /// 送信先アドレス入力エリアが変更されたときに、送信ボタンの有効化・無効化を行います。
148+ /// </summary>
149+ /// <param name="sender">センダ。</param>
150+ /// <param name="e">イベントデータを格納したオブジェクト。</param>
151+ protected void OnSendAddressEntryChanged(object sender, EventArgs e)
152+ {
153+ sendButton.Sensitive = (sendAddressEntry.Text.Length > 0 &&
154+ sendPortNoEntry.Text.Length > 0 &&
155+ messageEntry.Text.Length > 0);
156+ }
157+
158+ /// <summary>
159+ /// 送信ポート番号入力エリアが変更されたときに、送信ボタンの有効化・無効化を行います。
160+ /// </summary>
161+ /// <param name="sender">センダ。</param>
162+ /// <param name="e">イベントデータを格納したオブジェクト。</param>
163+ protected void OnSendPortNoEntryChanged(object sender, EventArgs e)
164+ {
165+ sendButton.Sensitive = (sendAddressEntry.Text.Length > 0 &&
166+ sendPortNoEntry.Text.Length > 0 &&
167+ messageEntry.Text.Length > 0);
168+ }
169+
170+ /// <summary>
171+ /// メッセージ入力エリアが変更されたときに、送信ボタンの有効化・無効化を行います。
172+ /// </summary>
173+ /// <param name="sender">センダ。</param>
174+ /// <param name="e">イベントデータを格納したオブジェクト。</param>
175+ protected void OnMessageEntryChanged(object sender, EventArgs e)
176+ {
177+ sendButton.Sensitive = (sendAddressEntry.Text.Length > 0 &&
178+ sendPortNoEntry.Text.Length > 0 &&
179+ messageEntry.Text.Length > 0);
180+ }
181+
182+ /// <summary>
183+ /// チャットメッセージを受信したときに、テキストビューにメッセージを追加します。
184+ /// </summary>
185+ /// <param name="sender">センダ。</param>
186+ /// <param name="e">イベントデータを格納したオブジェクト。</param>
187+ protected void OnMessageReceived(object sender, UdpDataReceivedEventArgs e)
188+ {
189+ Encoding encoding = new UTF8Encoding(false);
190+ string message = encoding.GetString(e.Data);
191+
192+ receiveTextView.Buffer.Text += e.SourceEndPoint.ToString() + "> " + message + "\n";
193+ }
194+}
--- /dev/null
+++ b/src/SocketNet/SampleUdpChatGtkClient/Program.cs
@@ -0,0 +1,42 @@
1+//
2+// Program.cs
3+//
4+// Author:
5+// tsntsumi <tsntsumi at tsntsumi.com>
6+//
7+// Copyright (c) 2015 tsntsumi
8+//
9+// This program is free software: you can redistribute it and/or modify
10+// it under the terms of the GNU Lesser General Public License as published by
11+// the Free Software Foundation, either version 3 of the License, or
12+// (at your option) any later version.
13+//
14+// This program is distributed in the hope that it will be useful,
15+// but WITHOUT ANY WARRANTY; without even the implied warranty of
16+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+// GNU Lesser General Public License for more details.
18+//
19+// You should have received a copy of the GNU Lesser General Public License
20+// along with this program. If not, see <http://www.gnu.org/licenses/>.
21+
22+/// @file
23+/// <summary>
24+/// SocketNet ライブラリのサンプルプログラム (GTK# ベースの簡単なチャットクライアント)。
25+/// </summary>
26+/// @since 2015.8.23
27+using System;
28+using Gtk;
29+
30+namespace SampleUdpChatGtkClient
31+{
32+ class MainClass
33+ {
34+ public static void Main(string[] args)
35+ {
36+ Application.Init();
37+ MainWindow win = new MainWindow();
38+ win.Show();
39+ Application.Run();
40+ }
41+ }
42+}
--- /dev/null
+++ b/src/SocketNet/SampleUdpChatGtkClient/Properties/AssemblyInfo.cs
@@ -0,0 +1,47 @@
1+//
2+// AssemblyInfo.cs
3+//
4+// Author:
5+// tsntsumi <>
6+//
7+// Copyright (c) 2015 tsntsumi
8+//
9+// This program is free software: you can redistribute it and/or modify
10+// it under the terms of the GNU Lesser General Public License as published by
11+// the Free Software Foundation, either version 3 of the License, or
12+// (at your option) any later version.
13+//
14+// This program is distributed in the hope that it will be useful,
15+// but WITHOUT ANY WARRANTY; without even the implied warranty of
16+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+// GNU Lesser General Public License for more details.
18+//
19+// You should have received a copy of the GNU Lesser General Public License
20+// along with this program. If not, see <http://www.gnu.org/licenses/>.
21+using System.Reflection;
22+using System.Runtime.CompilerServices;
23+
24+// Information about this assembly is defined by the following attributes.
25+// Change them to the values specific to your project.
26+
27+[assembly: AssemblyTitle("SampleUdpChatGtkClient")]
28+[assembly: AssemblyDescription("")]
29+[assembly: AssemblyConfiguration("")]
30+[assembly: AssemblyCompany("")]
31+[assembly: AssemblyProduct("")]
32+[assembly: AssemblyCopyright("tsntsumi")]
33+[assembly: AssemblyTrademark("")]
34+[assembly: AssemblyCulture("")]
35+
36+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
37+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
38+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
39+
40+[assembly: AssemblyVersion("1.0.*")]
41+
42+// The following attributes are used to specify the signing key for the assembly,
43+// if desired. See the Mono documentation for more information about signing.
44+
45+//[assembly: AssemblyDelaySign(false)]
46+//[assembly: AssemblyKeyFile("")]
47+
--- /dev/null
+++ b/src/SocketNet/SampleUdpChatGtkClient/SampleUdpChatGtkClient.csproj
@@ -0,0 +1,71 @@
1+<?xml version="1.0" encoding="utf-8"?>
2+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+ <PropertyGroup>
4+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+ <ProjectGuid>{6A2E3BA9-6272-4476-A7AC-C0B421AE11B3}</ProjectGuid>
7+ <OutputType>WinExe</OutputType>
8+ <RootNamespace>SampleUdpChatGtkClient</RootNamespace>
9+ <AssemblyName>SampleUdpChatGtkClient</AssemblyName>
10+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
11+ </PropertyGroup>
12+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
13+ <DebugSymbols>true</DebugSymbols>
14+ <DebugType>full</DebugType>
15+ <Optimize>false</Optimize>
16+ <OutputPath>bin\Debug</OutputPath>
17+ <DefineConstants>DEBUG;</DefineConstants>
18+ <ErrorReport>prompt</ErrorReport>
19+ <WarningLevel>4</WarningLevel>
20+ <ConsolePause>false</ConsolePause>
21+ </PropertyGroup>
22+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23+ <DebugType>full</DebugType>
24+ <Optimize>true</Optimize>
25+ <OutputPath>bin\Release</OutputPath>
26+ <ErrorReport>prompt</ErrorReport>
27+ <WarningLevel>4</WarningLevel>
28+ <ConsolePause>false</ConsolePause>
29+ </PropertyGroup>
30+ <ItemGroup>
31+ <Reference Include="System" />
32+ <Reference Include="gtk-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
33+ <SpecificVersion>False</SpecificVersion>
34+ </Reference>
35+ <Reference Include="gdk-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
36+ <SpecificVersion>False</SpecificVersion>
37+ </Reference>
38+ <Reference Include="glib-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
39+ <SpecificVersion>False</SpecificVersion>
40+ </Reference>
41+ <Reference Include="glade-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
42+ <SpecificVersion>False</SpecificVersion>
43+ </Reference>
44+ <Reference Include="pango-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
45+ <SpecificVersion>False</SpecificVersion>
46+ </Reference>
47+ <Reference Include="atk-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
48+ <SpecificVersion>False</SpecificVersion>
49+ </Reference>
50+ <Reference Include="Mono.Posix" />
51+ </ItemGroup>
52+ <ItemGroup>
53+ <EmbeddedResource Include="gtk-gui\gui.stetic">
54+ <LogicalName>gui.stetic</LogicalName>
55+ </EmbeddedResource>
56+ </ItemGroup>
57+ <ItemGroup>
58+ <Compile Include="gtk-gui\generated.cs" />
59+ <Compile Include="MainWindow.cs" />
60+ <Compile Include="gtk-gui\MainWindow.cs" />
61+ <Compile Include="Program.cs" />
62+ <Compile Include="Properties\AssemblyInfo.cs" />
63+ </ItemGroup>
64+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
65+ <ItemGroup>
66+ <ProjectReference Include="..\SocketNet\SocketNet.csproj">
67+ <Project>{1D22C9BE-96BA-4DE2-882C-E82E3421764B}</Project>
68+ <Name>SocketNet</Name>
69+ </ProjectReference>
70+ </ItemGroup>
71+</Project>
\ No newline at end of file
--- /dev/null
+++ b/src/SocketNet/SampleUdpChatGtkClient/gtk-gui/MainWindow.cs
@@ -0,0 +1,216 @@
1+
2+// This file has been generated by the GUI designer. Do not modify.
3+
4+public partial class MainWindow
5+{
6+ private global::Gtk.VBox vbox1;
7+
8+ private global::Gtk.HBox hbox1;
9+
10+ private global::Gtk.Label label1;
11+
12+ private global::Gtk.Entry receivePortNoEntry;
13+
14+ private global::Gtk.Button startReceiveButton;
15+
16+ private global::Gtk.Button stopReceiveButton;
17+
18+ private global::Gtk.HBox hbox2;
19+
20+ private global::Gtk.Label label4;
21+
22+ private global::Gtk.Entry sendAddressEntry;
23+
24+ private global::Gtk.Label label2;
25+
26+ private global::Gtk.Entry sendPortNoEntry;
27+
28+ private global::Gtk.HBox hbox3;
29+
30+ private global::Gtk.Label label3;
31+
32+ private global::Gtk.Entry messageEntry;
33+
34+ private global::Gtk.Button sendButton;
35+
36+ private global::Gtk.ScrolledWindow GtkScrolledWindow;
37+
38+ private global::Gtk.TextView receiveTextView;
39+
40+ protected virtual void Build ()
41+ {
42+ global::Stetic.Gui.Initialize (this);
43+ // Widget MainWindow
44+ this.Name = "MainWindow";
45+ this.Title = global::Mono.Unix.Catalog.GetString ("MainWindow");
46+ this.WindowPosition = ((global::Gtk.WindowPosition)(4));
47+ // Container child MainWindow.Gtk.Container+ContainerChild
48+ this.vbox1 = new global::Gtk.VBox ();
49+ this.vbox1.Name = "vbox1";
50+ this.vbox1.Spacing = 6;
51+ this.vbox1.BorderWidth = ((uint)(6));
52+ // Container child vbox1.Gtk.Box+BoxChild
53+ this.hbox1 = new global::Gtk.HBox ();
54+ this.hbox1.Name = "hbox1";
55+ this.hbox1.Spacing = 6;
56+ // Container child hbox1.Gtk.Box+BoxChild
57+ this.label1 = new global::Gtk.Label ();
58+ this.label1.Name = "label1";
59+ this.label1.LabelProp = global::Mono.Unix.Catalog.GetString ("受信ポート");
60+ this.hbox1.Add (this.label1);
61+ global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.label1]));
62+ w1.Position = 0;
63+ w1.Expand = false;
64+ w1.Fill = false;
65+ // Container child hbox1.Gtk.Box+BoxChild
66+ this.receivePortNoEntry = new global::Gtk.Entry ();
67+ this.receivePortNoEntry.CanFocus = true;
68+ this.receivePortNoEntry.Name = "receivePortNoEntry";
69+ this.receivePortNoEntry.IsEditable = true;
70+ this.receivePortNoEntry.InvisibleChar = '●';
71+ this.hbox1.Add (this.receivePortNoEntry);
72+ global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.receivePortNoEntry]));
73+ w2.Position = 1;
74+ // Container child hbox1.Gtk.Box+BoxChild
75+ this.startReceiveButton = new global::Gtk.Button ();
76+ this.startReceiveButton.Sensitive = false;
77+ this.startReceiveButton.CanFocus = true;
78+ this.startReceiveButton.Name = "startReceiveButton";
79+ this.startReceiveButton.UseUnderline = true;
80+ this.startReceiveButton.Label = global::Mono.Unix.Catalog.GetString ("開始");
81+ this.hbox1.Add (this.startReceiveButton);
82+ global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.startReceiveButton]));
83+ w3.Position = 2;
84+ w3.Expand = false;
85+ w3.Fill = false;
86+ // Container child hbox1.Gtk.Box+BoxChild
87+ this.stopReceiveButton = new global::Gtk.Button ();
88+ this.stopReceiveButton.Sensitive = false;
89+ this.stopReceiveButton.CanFocus = true;
90+ this.stopReceiveButton.Name = "stopReceiveButton";
91+ this.stopReceiveButton.UseUnderline = true;
92+ this.stopReceiveButton.Label = global::Mono.Unix.Catalog.GetString ("停止");
93+ this.hbox1.Add (this.stopReceiveButton);
94+ global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.stopReceiveButton]));
95+ w4.Position = 3;
96+ w4.Expand = false;
97+ w4.Fill = false;
98+ this.vbox1.Add (this.hbox1);
99+ global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.hbox1]));
100+ w5.Position = 0;
101+ w5.Expand = false;
102+ w5.Fill = false;
103+ // Container child vbox1.Gtk.Box+BoxChild
104+ this.hbox2 = new global::Gtk.HBox ();
105+ this.hbox2.Name = "hbox2";
106+ this.hbox2.Spacing = 6;
107+ // Container child hbox2.Gtk.Box+BoxChild
108+ this.label4 = new global::Gtk.Label ();
109+ this.label4.Name = "label4";
110+ this.label4.LabelProp = global::Mono.Unix.Catalog.GetString ("送信先アドレス");
111+ this.hbox2.Add (this.label4);
112+ global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.label4]));
113+ w6.Position = 0;
114+ w6.Expand = false;
115+ w6.Fill = false;
116+ // Container child hbox2.Gtk.Box+BoxChild
117+ this.sendAddressEntry = new global::Gtk.Entry ();
118+ this.sendAddressEntry.CanFocus = true;
119+ this.sendAddressEntry.Name = "sendAddressEntry";
120+ this.sendAddressEntry.IsEditable = true;
121+ this.sendAddressEntry.InvisibleChar = '●';
122+ this.hbox2.Add (this.sendAddressEntry);
123+ global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.sendAddressEntry]));
124+ w7.Position = 1;
125+ // Container child hbox2.Gtk.Box+BoxChild
126+ this.label2 = new global::Gtk.Label ();
127+ this.label2.Name = "label2";
128+ this.label2.LabelProp = global::Mono.Unix.Catalog.GetString ("ポート");
129+ this.hbox2.Add (this.label2);
130+ global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.label2]));
131+ w8.Position = 2;
132+ w8.Expand = false;
133+ w8.Fill = false;
134+ // Container child hbox2.Gtk.Box+BoxChild
135+ this.sendPortNoEntry = new global::Gtk.Entry ();
136+ this.sendPortNoEntry.CanFocus = true;
137+ this.sendPortNoEntry.Name = "sendPortNoEntry";
138+ this.sendPortNoEntry.IsEditable = true;
139+ this.sendPortNoEntry.InvisibleChar = '●';
140+ this.hbox2.Add (this.sendPortNoEntry);
141+ global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.sendPortNoEntry]));
142+ w9.Position = 3;
143+ this.vbox1.Add (this.hbox2);
144+ global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.hbox2]));
145+ w10.Position = 1;
146+ w10.Expand = false;
147+ w10.Fill = false;
148+ // Container child vbox1.Gtk.Box+BoxChild
149+ this.hbox3 = new global::Gtk.HBox ();
150+ this.hbox3.Name = "hbox3";
151+ this.hbox3.Spacing = 6;
152+ // Container child hbox3.Gtk.Box+BoxChild
153+ this.label3 = new global::Gtk.Label ();
154+ this.label3.Name = "label3";
155+ this.label3.LabelProp = global::Mono.Unix.Catalog.GetString ("メッセージ");
156+ this.hbox3.Add (this.label3);
157+ global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.label3]));
158+ w11.Position = 0;
159+ w11.Expand = false;
160+ w11.Fill = false;
161+ // Container child hbox3.Gtk.Box+BoxChild
162+ this.messageEntry = new global::Gtk.Entry ();
163+ this.messageEntry.CanFocus = true;
164+ this.messageEntry.Name = "messageEntry";
165+ this.messageEntry.IsEditable = true;
166+ this.messageEntry.InvisibleChar = '●';
167+ this.hbox3.Add (this.messageEntry);
168+ global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.messageEntry]));
169+ w12.Position = 1;
170+ // Container child hbox3.Gtk.Box+BoxChild
171+ this.sendButton = new global::Gtk.Button ();
172+ this.sendButton.Sensitive = false;
173+ this.sendButton.CanFocus = true;
174+ this.sendButton.Name = "sendButton";
175+ this.sendButton.UseUnderline = true;
176+ this.sendButton.Label = global::Mono.Unix.Catalog.GetString ("送信");
177+ this.hbox3.Add (this.sendButton);
178+ global::Gtk.Box.BoxChild w13 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.sendButton]));
179+ w13.Position = 2;
180+ w13.Expand = false;
181+ w13.Fill = false;
182+ this.vbox1.Add (this.hbox3);
183+ global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.hbox3]));
184+ w14.Position = 2;
185+ w14.Expand = false;
186+ w14.Fill = false;
187+ // Container child vbox1.Gtk.Box+BoxChild
188+ this.GtkScrolledWindow = new global::Gtk.ScrolledWindow ();
189+ this.GtkScrolledWindow.Name = "GtkScrolledWindow";
190+ this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1));
191+ // Container child GtkScrolledWindow.Gtk.Container+ContainerChild
192+ this.receiveTextView = new global::Gtk.TextView ();
193+ this.receiveTextView.CanFocus = true;
194+ this.receiveTextView.Name = "receiveTextView";
195+ this.receiveTextView.Editable = false;
196+ this.GtkScrolledWindow.Add (this.receiveTextView);
197+ this.vbox1.Add (this.GtkScrolledWindow);
198+ global::Gtk.Box.BoxChild w16 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.GtkScrolledWindow]));
199+ w16.Position = 3;
200+ this.Add (this.vbox1);
201+ if ((this.Child != null)) {
202+ this.Child.ShowAll ();
203+ }
204+ this.DefaultWidth = 651;
205+ this.DefaultHeight = 464;
206+ this.Show ();
207+ this.DeleteEvent += new global::Gtk.DeleteEventHandler (this.OnDeleteEvent);
208+ this.receivePortNoEntry.Changed += new global::System.EventHandler (this.OnReceivePortNoEntryChanged);
209+ this.startReceiveButton.Clicked += new global::System.EventHandler (this.OnStartReceiveButtonClicked);
210+ this.stopReceiveButton.Clicked += new global::System.EventHandler (this.OnStopReceiveButtonClicked);
211+ this.sendAddressEntry.Changed += new global::System.EventHandler (this.OnSendAddressEntryChanged);
212+ this.sendPortNoEntry.Changed += new global::System.EventHandler (this.OnSendPortNoEntryChanged);
213+ this.messageEntry.Changed += new global::System.EventHandler (this.OnMessageEntryChanged);
214+ this.sendButton.Clicked += new global::System.EventHandler (this.OnSendButtonClicked);
215+ }
216+}
--- /dev/null
+++ b/src/SocketNet/SampleUdpChatGtkClient/gtk-gui/generated.cs
@@ -0,0 +1,29 @@
1+
2+// This file has been generated by the GUI designer. Do not modify.
3+namespace Stetic
4+{
5+ internal class Gui
6+ {
7+ private static bool initialized;
8+
9+ internal static void Initialize (Gtk.Widget iconRenderer)
10+ {
11+ if ((Stetic.Gui.initialized == false)) {
12+ Stetic.Gui.initialized = true;
13+ }
14+ }
15+ }
16+
17+ internal class ActionGroups
18+ {
19+ public static Gtk.ActionGroup GetActionGroup (System.Type type)
20+ {
21+ return Stetic.ActionGroups.GetActionGroup (type.FullName);
22+ }
23+
24+ public static Gtk.ActionGroup GetActionGroup (string name)
25+ {
26+ return null;
27+ }
28+ }
29+}
--- /dev/null
+++ b/src/SocketNet/SampleUdpChatGtkClient/gtk-gui/gui.stetic
@@ -0,0 +1,230 @@
1+<?xml version="1.0" encoding="utf-8"?>
2+<stetic-interface>
3+ <configuration>
4+ <images-root-path>..</images-root-path>
5+ </configuration>
6+ <import>
7+ <widget-library name="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
8+ <widget-library name="../bin/Debug/SampleUdpChatGtkClient.exe" internal="true" />
9+ </import>
10+ <widget class="Gtk.Window" id="MainWindow" design-size="651 464">
11+ <property name="MemberName" />
12+ <property name="Title" translatable="yes">UDP Chat</property>
13+ <property name="WindowPosition">CenterOnParent</property>
14+ <signal name="DeleteEvent" handler="OnDeleteEvent" />
15+ <child>
16+ <widget class="Gtk.VBox" id="vbox1">
17+ <property name="MemberName" />
18+ <property name="Spacing">6</property>
19+ <property name="BorderWidth">6</property>
20+ <child>
21+ <widget class="Gtk.HBox" id="hbox1">
22+ <property name="MemberName" />
23+ <property name="Spacing">6</property>
24+ <child>
25+ <widget class="Gtk.Label" id="label1">
26+ <property name="MemberName" />
27+ <property name="LabelProp" translatable="yes">Receive Port:</property>
28+ </widget>
29+ <packing>
30+ <property name="Position">0</property>
31+ <property name="AutoSize">True</property>
32+ <property name="Expand">False</property>
33+ <property name="Fill">False</property>
34+ </packing>
35+ </child>
36+ <child>
37+ <widget class="Gtk.Entry" id="receivePortNoEntry">
38+ <property name="MemberName" />
39+ <property name="CanFocus">True</property>
40+ <property name="IsEditable">True</property>
41+ <property name="InvisibleChar">●</property>
42+ <signal name="Changed" handler="OnReceivePortNoEntryChanged" />
43+ </widget>
44+ <packing>
45+ <property name="Position">1</property>
46+ <property name="AutoSize">True</property>
47+ </packing>
48+ </child>
49+ <child>
50+ <widget class="Gtk.Button" id="startReceiveButton">
51+ <property name="MemberName" />
52+ <property name="Sensitive">False</property>
53+ <property name="CanFocus">True</property>
54+ <property name="Type">TextOnly</property>
55+ <property name="Label" translatable="yes">Start</property>
56+ <property name="UseUnderline">True</property>
57+ <signal name="Clicked" handler="OnStartReceiveButtonClicked" />
58+ </widget>
59+ <packing>
60+ <property name="Position">2</property>
61+ <property name="AutoSize">True</property>
62+ <property name="Expand">False</property>
63+ <property name="Fill">False</property>
64+ </packing>
65+ </child>
66+ <child>
67+ <widget class="Gtk.Button" id="stopReceiveButton">
68+ <property name="MemberName" />
69+ <property name="Sensitive">False</property>
70+ <property name="CanFocus">True</property>
71+ <property name="Type">TextOnly</property>
72+ <property name="Label" translatable="yes">Stop</property>
73+ <property name="UseUnderline">True</property>
74+ <signal name="Clicked" handler="OnStopReceiveButtonClicked" />
75+ </widget>
76+ <packing>
77+ <property name="Position">3</property>
78+ <property name="AutoSize">True</property>
79+ <property name="Expand">False</property>
80+ <property name="Fill">False</property>
81+ </packing>
82+ </child>
83+ </widget>
84+ <packing>
85+ <property name="Position">0</property>
86+ <property name="AutoSize">True</property>
87+ <property name="Expand">False</property>
88+ <property name="Fill">False</property>
89+ </packing>
90+ </child>
91+ <child>
92+ <widget class="Gtk.HBox" id="hbox2">
93+ <property name="MemberName" />
94+ <property name="Spacing">6</property>
95+ <child>
96+ <widget class="Gtk.Label" id="label4">
97+ <property name="MemberName" />
98+ <property name="LabelProp" translatable="yes">Send Address:</property>
99+ </widget>
100+ <packing>
101+ <property name="Position">0</property>
102+ <property name="AutoSize">True</property>
103+ <property name="Expand">False</property>
104+ <property name="Fill">False</property>
105+ </packing>
106+ </child>
107+ <child>
108+ <widget class="Gtk.Entry" id="sendAddressEntry">
109+ <property name="MemberName" />
110+ <property name="Tooltip" translatable="yes">送信先アドレスには、特定のアドレスのほかにブロードキャストアドレスを指定できます。</property>
111+ <property name="CanFocus">True</property>
112+ <property name="IsEditable">True</property>
113+ <property name="InvisibleChar">●</property>
114+ <signal name="Changed" handler="OnSendAddressEntryChanged" />
115+ </widget>
116+ <packing>
117+ <property name="Position">1</property>
118+ <property name="AutoSize">True</property>
119+ </packing>
120+ </child>
121+ <child>
122+ <widget class="Gtk.Label" id="label2">
123+ <property name="MemberName" />
124+ <property name="LabelProp" translatable="yes">Send Port:</property>
125+ </widget>
126+ <packing>
127+ <property name="Position">2</property>
128+ <property name="AutoSize">True</property>
129+ <property name="Expand">False</property>
130+ <property name="Fill">False</property>
131+ </packing>
132+ </child>
133+ <child>
134+ <widget class="Gtk.Entry" id="sendPortNoEntry">
135+ <property name="MemberName" />
136+ <property name="CanFocus">True</property>
137+ <property name="IsEditable">True</property>
138+ <property name="InvisibleChar">●</property>
139+ <signal name="Changed" handler="OnSendPortNoEntryChanged" />
140+ </widget>
141+ <packing>
142+ <property name="Position">3</property>
143+ <property name="AutoSize">True</property>
144+ </packing>
145+ </child>
146+ </widget>
147+ <packing>
148+ <property name="Position">1</property>
149+ <property name="AutoSize">True</property>
150+ <property name="Expand">False</property>
151+ <property name="Fill">False</property>
152+ </packing>
153+ </child>
154+ <child>
155+ <widget class="Gtk.HBox" id="hbox3">
156+ <property name="MemberName" />
157+ <property name="Spacing">6</property>
158+ <child>
159+ <widget class="Gtk.Label" id="label3">
160+ <property name="MemberName" />
161+ <property name="LabelProp" translatable="yes">Message:</property>
162+ </widget>
163+ <packing>
164+ <property name="Position">0</property>
165+ <property name="AutoSize">True</property>
166+ <property name="Expand">False</property>
167+ <property name="Fill">False</property>
168+ </packing>
169+ </child>
170+ <child>
171+ <widget class="Gtk.Entry" id="messageEntry">
172+ <property name="MemberName" />
173+ <property name="CanFocus">True</property>
174+ <property name="IsEditable">True</property>
175+ <property name="InvisibleChar">●</property>
176+ <signal name="Changed" handler="OnMessageEntryChanged" />
177+ </widget>
178+ <packing>
179+ <property name="Position">1</property>
180+ <property name="AutoSize">True</property>
181+ </packing>
182+ </child>
183+ <child>
184+ <widget class="Gtk.Button" id="sendButton">
185+ <property name="MemberName" />
186+ <property name="Sensitive">False</property>
187+ <property name="CanFocus">True</property>
188+ <property name="Type">TextOnly</property>
189+ <property name="Label" translatable="yes">Send</property>
190+ <property name="UseUnderline">True</property>
191+ <signal name="Clicked" handler="OnSendButtonClicked" />
192+ </widget>
193+ <packing>
194+ <property name="Position">2</property>
195+ <property name="AutoSize">True</property>
196+ <property name="Expand">False</property>
197+ <property name="Fill">False</property>
198+ </packing>
199+ </child>
200+ </widget>
201+ <packing>
202+ <property name="Position">2</property>
203+ <property name="AutoSize">True</property>
204+ <property name="Expand">False</property>
205+ <property name="Fill">False</property>
206+ </packing>
207+ </child>
208+ <child>
209+ <widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow">
210+ <property name="MemberName" />
211+ <property name="ShadowType">In</property>
212+ <child>
213+ <widget class="Gtk.TextView" id="receiveTextView">
214+ <property name="MemberName" />
215+ <property name="CanFocus">True</property>
216+ <property name="ShowScrollbars">True</property>
217+ <property name="Editable">False</property>
218+ <property name="Text" translatable="yes" />
219+ </widget>
220+ </child>
221+ </widget>
222+ <packing>
223+ <property name="Position">3</property>
224+ <property name="AutoSize">True</property>
225+ </packing>
226+ </child>
227+ </widget>
228+ </child>
229+ </widget>
230+</stetic-interface>
\ No newline at end of file
--- a/src/SocketNet/SocketNet.sln
+++ b/src/SocketNet/SocketNet.sln
@@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleChatGtkClient", "Samp
99 EndProject
1010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleChatClient", "SampleChatClient\SampleChatClient.csproj", "{376FE66A-0AC9-4DD0-80D9-099D45291369}"
1111 EndProject
12+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleUdpChatGtkClient", "SampleUdpChatGtkClient\SampleUdpChatGtkClient.csproj", "{6A2E3BA9-6272-4476-A7AC-C0B421AE11B3}"
13+EndProject
1214 Global
1315 GlobalSection(SolutionConfigurationPlatforms) = preSolution
1416 Debug|Any CPU = Debug|Any CPU
@@ -23,6 +25,10 @@ Global
2325 {376FE66A-0AC9-4DD0-80D9-099D45291369}.Debug|Any CPU.Build.0 = Debug|Any CPU
2426 {376FE66A-0AC9-4DD0-80D9-099D45291369}.Release|Any CPU.ActiveCfg = Release|Any CPU
2527 {376FE66A-0AC9-4DD0-80D9-099D45291369}.Release|Any CPU.Build.0 = Release|Any CPU
28+ {6A2E3BA9-6272-4476-A7AC-C0B421AE11B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+ {6A2E3BA9-6272-4476-A7AC-C0B421AE11B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+ {6A2E3BA9-6272-4476-A7AC-C0B421AE11B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+ {6A2E3BA9-6272-4476-A7AC-C0B421AE11B3}.Release|Any CPU.Build.0 = Release|Any CPU
2632 {799CAE9B-9FE6-4639-B5F6-75C87923C6E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2733 {799CAE9B-9FE6-4639-B5F6-75C87923C6E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
2834 {799CAE9B-9FE6-4639-B5F6-75C87923C6E6}.Release|Any CPU.ActiveCfg = Release|Any CPU