TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
yokzu
NA
306
0
About socket programming
Jan 7 2010 2:33 PM
Hi,
My server side codes are below. When I click the button first time at client side, data isnt going to server side. When I click second and third times, data is going normally. Why data isnt going at first click?
public void Form1_Load(object sender, EventArgs e)
{
CheckForIllegalCrossThreadCalls = false;
thread_dinleyici = new Thread(new ThreadStart(dinle));
thread_dinleyici.Start();
}
public void dinle()
{
tcp_listener = new TcpListener(4444);
tcp_listener.Start();
istemcisoketi = tcp_listener.AcceptSocket();
if (istemcisoketi.Connected)
{
while (true)
{
istemcisoketi = tcp_listener.AcceptSocket();
ag_akimi = new NetworkStream(istemcisoketi);
akim_okuyucu = new StreamReader(ag_akimi);
akim_yazici = new StreamWriter(ag_akimi);
try
{
gelen_veri = akim_okuyucu.ReadLine();
if (gelen_veri.EndsWith("??"))
{
yaz(gelen_veri);
}
}
catch
{
return;
}
}
}
}
public void yaz(string e)
{
sunucu_bag.Open();
OleDbCommand cmd_veriyi_yaz = new OleDbCommand("INSERT INTO notlar (iletiler,tarih) VALUES ('" + e + "' , '" + DateTime.Now + "')", sunucu_bag);
cmd_veriyi_yaz.ExecuteNonQuery();
sunucu_bag.Close();
}
Reply
Answers (
2
)
Text Files -- Extracting Data
Beginer class