Click here to Skip to main content
15,890,407 members
Home / Discussions / C#
   

C#

 
AnswerRe: To Create or to Clear Pin
SeMartens31-Mar-09 0:46
SeMartens31-Mar-09 0:46 
GeneralRe: To Create or to Clear Pin
musefan31-Mar-09 0:50
musefan31-Mar-09 0:50 
AnswerRe: To Create or to Clear Pin
PIEBALDconsult31-Mar-09 7:26
mvePIEBALDconsult31-Mar-09 7:26 
QuestionClient and Server Program Pin
Vinziee31-Mar-09 0:28
Vinziee31-Mar-09 0:28 
AnswerRe: Client and Server Program Pin
SeMartens31-Mar-09 0:39
SeMartens31-Mar-09 0:39 
GeneralRe: Client and Server Program Pin
Vinziee31-Mar-09 1:22
Vinziee31-Mar-09 1:22 
GeneralRe: Client and Server Program Pin
SeMartens31-Mar-09 1:54
SeMartens31-Mar-09 1:54 
GeneralRe: Client and Server Program Pin
Vinziee31-Mar-09 2:31
Vinziee31-Mar-09 2:31 
hey sebastian thx for ur reply
.
i tried that it still says only one usage of each socket is allowed

************************the new code for server************************************************
using System;
using System.Threading;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net.Sockets;
using System.Net;

namespace server
{
public partial class Form1 : Form
{
UdpClient server;
Thread thdserver;
public Form1()
{
InitializeComponent();
}
public void recieve()
{
try
{
server = new UdpClient(8080);
while (true)
{
IPEndPoint ip = new IPEndPoint(IPAddress.Any, 0);
byte[] recieved = server.Receive(ref ip);
string returndata = Encoding.ASCII.GetString(recieved);
listBox1.Items.Add(ip.Address.ToString() + " : " + returndata.ToString());
}
}
catch (SocketException ex)
{
MessageBox.Show(ex.Message);
}
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
//recieve();
thdserver = new Thread(new ThreadStart(recieve));
thdserver.Start();

}

private void button2_Click(object sender, EventArgs e)
{
server.Close();
}

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
server.Close();
}
}
}

*********************the new code for client****************************************
using System;
using System.Threading;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net.Sockets;
using System.Net;

namespace ser_cli
{
public partial class Form1 : Form
{
UdpClient client = new UdpClient();
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
Thread th = new Thread(new ThreadStart(hear));
th.Start();


}
private void hear()
{

client.Connect(tbHost.Text, 8080);
byte[] send = Encoding.ASCII.GetBytes(textBox1.Text);
client.Send(send, send.Length);
}

private void btnStop_Click(object sender, EventArgs e)
{
client.Close();
}

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
client.Close();
}
}
}
GeneralRe: Client and Server Program Pin
SeMartens31-Mar-09 2:57
SeMartens31-Mar-09 2:57 
GeneralRe: Client and Server Program Pin
Vinziee31-Mar-09 4:27
Vinziee31-Mar-09 4:27 
GeneralRe: Client and Server Program Pin
0x3c031-Mar-09 7:02
0x3c031-Mar-09 7:02 
GeneralRe: Client and Server Program Pin
Vinziee1-Apr-09 0:28
Vinziee1-Apr-09 0:28 
GeneralRe: Client and Server Program Pin
SeMartens31-Mar-09 9:18
SeMartens31-Mar-09 9:18 
GeneralRe: Client and Server Program Pin
Vinziee1-Apr-09 0:29
Vinziee1-Apr-09 0:29 
AnswerRe: Client and Server Program Pin
musefan31-Mar-09 0:49
musefan31-Mar-09 0:49 
GeneralRe: Client and Server Program Pin
Vinziee31-Mar-09 1:23
Vinziee31-Mar-09 1:23 
GeneralRe: Client and Server Program Pin
EliottA31-Mar-09 2:15
EliottA31-Mar-09 2:15 
AnswerRe: Client and Server Program Pin
agent00zelda31-Mar-09 2:30
agent00zelda31-Mar-09 2:30 
GeneralRe: Client and Server Program Pin
Vinziee31-Mar-09 2:35
Vinziee31-Mar-09 2:35 
QuestionRotate and Resize a Rectangle Pin
Madmanxxx30-Mar-09 23:34
Madmanxxx30-Mar-09 23:34 
AnswerRe: Rotate and Resize a Rectangle Pin
Mustafa Ismail Mustafa30-Mar-09 23:40
Mustafa Ismail Mustafa30-Mar-09 23:40 
GeneralRe: Rotate and Resize a Rectangle Pin
Madmanxxx30-Mar-09 23:44
Madmanxxx30-Mar-09 23:44 
GeneralRe: Rotate and Resize a Rectangle Pin
Mustafa Ismail Mustafa31-Mar-09 0:07
Mustafa Ismail Mustafa31-Mar-09 0:07 
AnswerRe: Rotate and Resize a Rectangle Pin
musefan31-Mar-09 0:22
musefan31-Mar-09 0:22 
GeneralRe: Rotate and Resize a Rectangle Pin
Madmanxxx31-Mar-09 0:32
Madmanxxx31-Mar-09 0:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.