473,413 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Server sending data then client recive and store in database table in windows service

When server send data then client receive that data, in C# windows services where data receive continuously (Using IP Address and port number) . Please any one have idea help me code. Thanks one and all. This below code writing in console application . i want implement same logic in windows service side. but i want data receive continuously.

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Net;
  6. using System.Net.Sockets;
  7. using System.Threading.Tasks;
  8. using System.IO;
  9.  
  10.  
  11. namespace ClientApplication
  12. {
  13.  
  14.  
  15.  
  16.     class Client
  17.         {
  18.         public static void Main()
  19.         {
  20.             IPEndPoint ip = new IPEndPoint(IPAddress.Parse("192.168.1.202"), 9000);
  21.  
  22.             Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  23.  
  24.             try
  25.             {
  26.                 server.Connect(ip);
  27.             }
  28.             catch (SocketException e)
  29.             {
  30.                 Console.WriteLine("Unable to connect to server." +e);
  31.                 return;
  32.             }
  33.  
  34.             byte[] data = new byte[1024];
  35.             int receivedDataLength = server.Receive(data);
  36.             string stringData = Encoding.ASCII.GetString(data, 0, receivedDataLength);
  37.             Console.WriteLine(stringData);
  38.  
  39.             server.Shutdown(SocketShutdown.Both);
  40.             server.Close();
  41.         }
  42.  
  43.  
  44. }
  45.         }
Above code write in console application, same logic implementing in windows service, but i want data receiving continuously
Dec 22 '14 #1
3 1939
zmbd
5,501 Expert Mod 4TB
Gadicherla:
1) Not entirely sure of what you are asking; however, I think you can save the thread if you can reword the question.

2) Please use the "Post Reply" button and not the "Report Abuse" button to post to threads.
(^_^)
Dec 22 '14 #2
Actually i want server send data client receive that continuously using in windows services . above code I'm writing in console application, i want same logic in windows services side.
Dec 23 '14 #3
How to call server.Receive(data) in windows services
Dec 23 '14 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: J | last post by:
I create a windows application to delete old data in sql server without any problem. Then I create a windows service to handle this task due to this task is a daily basis job. I also have let this...
6
by: Nathan Kovac | last post by:
Yesterday afternoon I was getting the following errors in a windows service: 'DatabaseManager.DataComponent', 'Error', '3 Errors: Line: 0 - Metadata file 'ScriptingMethods.dll' could not be found...
20
by: Moty Michaely | last post by:
Hello, Can anyone please help me finding a good way to develop a c# winforms application client for a pre-developed windows service? Should I use wse2 with tcp protocol? Bu I still have win98...
15
by: Untitled | last post by:
I have an ASP .NET web application that displays information. At the same time, i have a web service that collects information from various client applications. This data needs to be processed...
0
by: SAVAGE | last post by:
Hi, I have writen IMAP4 server in VB.NET who act like Windows Serevice. I wrote .exe IMAP4 server service manager ( for my service ) that can start, pause and stop this IMAP4 server service. ...
3
by: Evan Camilleri | last post by:
I have a problem for a Windows Service to login on an SQL server (different machine) - neither Windows Authentication nor SQL Authentication worked. LOGIN FAILED FOR USER sa (for example). If...
2
by: kmsultan1 | last post by:
Hello all, I need help in trying to access a web page from a windows service. I've actually already built a windows application (vb.net) that does this using the AxSHDocVw.AxWebBrowser class....
2
by: steve | last post by:
Hi All I need to learn how to update a SQl server or Access database located on a web server from my windows forms application, via the internet I have a customer who wants to run several...
0
by: sreedharmcts | last post by:
I have Bulk data ,just want to insert that data from Gridview to Database table how it possible? I have done this way is it correct? protected void btn_insert_Click(object sender, EventArgs e) ...
1
by: svhmhema | last post by:
I have a combobox and a listbox. combobox data is populated from database table.When the user select an item from the combobox, then the listbox will show a certain data from the same table. How do I...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.