How to send raw data over a network?

How to send raw data over a network?

By : hoyanf
Date : January 02 2021, 06:48 AM
hope this fix your issue Try raw sockets (specify SOCK_RAW for the socket type).
You will be responsible for calculating the IP checksums as well. This can be a little annoying.
code :

Share : facebook icon twitter icon
Send data over the network C#

Send data over the network C#

By : user2537965
Date : March 29 2020, 07:55 AM
may help you . If you are using a connectionless protocol, you must call Connect before calling Send, or Send will throw a SocketException. If you are using a connection-oriented protocol, you must either use Connect to establish a remote host connection, or use Accept to accept an incoming connection. Refer Socket.Send Method (Byte[], Int32, SocketFlags)
Assuming you are using a connectionless protocol the code should be like this,
code :
string response = "Hello";
IPAddress ipAddress = IPAddress.Parse("");

if (ipAddress != null)
    IPEndPoint serverEndPoint = new IPEndPoint(ipAddress, 25);
    byte[] receiveBuffer = new byte[100];

        using (TcpClient client = new TcpClient(serverEndPoint))
            using (Socket socket = client.Client)

                byte[] data = Encoding.ASCII.GetBytes(response);

                socket.Send(data, data.Length, SocketFlags.None);


    catch (SocketException socketException)
        Console.WriteLine("Socket Exception : ", socketException.Message);
Should I use UTF-8 to send data over the network?

Should I use UTF-8 to send data over the network?

By : user3354753
Date : March 29 2020, 07:55 AM
wish helps you With UTF-8 encoding, you'll use:
1 byte for ASCII chars 2 bytes for unicode chars between U+0000 and U+07FF more bytes if necesseray
When no network - save data to sqlite and send to server once network regained

When no network - save data to sqlite and send to server once network regained

By : Ankit Kothari
Date : March 29 2020, 07:55 AM
Hope this helps You can save data to SQLite even if there is a network connection and then send it to API. In that case you can use only statemen in else from first step.
Below is the scenario you are looking for.
code :
  this.service.sendAction(itemID).subscribe(result => {})
  } else {
  this._databaseService.sendAction(itemID).then(result => {})
    this.count = 0;
    this._database.getLocalData().then((result) => {
        this.DataList = <Array<Object>> result;
        if(this.DataList.length !== 0){
          this.DataList.forEach(function(item) {
            this.service.sendAction(item).subscribe(result => {
            if(res.status == "ok" && this.count == this.DataList.length-1){ 
               //empty SQLite local table if success
        } else {
    }, (error) => {
            console.log("Offline data not sent!", 
public getLocalData() {
        return new Promise((resolve, reject) => {
        name: 'dbName.db',
        location: 'default'
        .then((db: SQLiteObject) => {
            db.executeSql("SELECT * FROM tableName", []).then((data) => {
                let DataList = [];
                if(data.rows.length > 0) {
                    for(let i = 0; i < data.rows.length; i++) {
                            itemID: data.rows.item(i).itemID,
                            something: data.rows.item(i).something
            }, (error) => {
         .catch(e => console.log(e));
detect if device connect to which network and then send data from server depends on which network connected

detect if device connect to which network and then send data from server depends on which network connected

By : user1536602
Date : March 29 2020, 07:55 AM
Hope this helps I want to check if my android device connected to which network (either wifi, home network, or mobile network) and then I want to use different the url link (use to send data to server) depends on which network the device connected. I'm new to android, and I already googled it but doesn't seems to find the answer or because of my limited vocabulary. Can anybody help me? , try to use this mate
code :
        final ConnectivityManager connMgr = (ConnectivityManager)
        final android.net.NetworkInfo wifi = connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
        final android.net.NetworkInfo mobile = connMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);

        if (wifi.isConnected()) {
            //do what you want
        } else if (mobile.isConnected()) {
            //do what you want
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
Is data secure as long as you send it from/to an HTTPS page? I can still see form data in chrome's network devoloper too

Is data secure as long as you send it from/to an HTTPS page? I can still see form data in chrome's network devoloper too

By : Richard Guan
Date : March 29 2020, 07:55 AM
wish helps you https secures only the connection from the user to the server. Once they are at the server they are no longer protected by https against attacks, so you have to find others ways to protect them there. https will also not protect the data from against attacks against the logic of the web application, like CSRF, XSS, clickjacking etc. In short: https is just one part to secure the data, there is much more.
Related Posts Related Posts :
  • Looking for a .Net ORM
  • Cost of SortedDictionary.Count
  • All possible combinations of n items selected randomly from a set of x items (algorithm)
  • Displaying process percentage on DOS screen
  • C# Importing Large Volume of Data from CSV to Database
  • c# control location precision
  • Printing to Zebra printer gives faint and blurry images
  • How to avoid stepping into dll code file?
  • Programmaticaly prevent Vista desktop search (WDS) from indexing pst files placed on mapped network drives
  • Is there anyway to reduce IsolatedStorage capacity in Silverlight?
  • C#: How to print a unicode string to console?
  • Frequency Table with Random Values
  • My Visual Studio 2008 web application keeps throwing a .Net error when I first run it, but refreshing fixes it
  • TCP Connection Creation and Closing Event Hooking
  • Find changed properties of a class
  • C#: Object with custom marshaller not containing data after PInvoke call
  • Version Control System with API. Need to get metrics
  • Performance comparison of Dictionaries
  • How to get process name and title of the top window on Windows / C#
  • How to save the ListView contents to a text file?
  • Why not .NET-style delegates rather than closures in Java?
  • Get CLSID by PIA interface Type
  • Visual Studio 2008 C# - Recover solution from application manifest possible?
  • Is a good practice to initialize private data members from within ctor by calling the associated properties instead of t
  • Inserting into a bitstream
  • How do you write byte[] array using log4.net
  • Clickonce + .NET client profile 4 framework + offline
  • Show form that showDialog from mainForm won't block it, but closing mainForm will close it
  • Developing a GPS car tracking system
  • dynamic log4net appender name?
  • Visual studio formatting issue
  • IndexOutOfRangeException when a stream is a multiple of the buffer size
  • How to deal with calculated values with Dependency Properties on a custom WPF control
  • counting from textbox,asp.net
  • Threading best practice when using SFTP in C#
  • how to load PDF file in website page using C#
  • Parent child class relationship design pattern
  • MessageQueue.BeginReceive() null ref error - c#
  • A C# collection, which behaves like C++ set or priority_queue?
  • Animating WPF buttons from inside a style
  • WPF Grid : GridSplitter event
  • Server 2008 Task Scheduler Mapped Drive Access C#
  • Cast problem with LINQ
  • Combo box Item source = ObservableCollection & I need a '-None-' dummy entry at the top
  • Which GUI control is suitable for this purpose?
  • Trying to access App.config file for mail settings but fails to work
  • Invoke PowerShell script from c# in runspace and get line number where error occured
  • How to show html contents with a RichTextBox?
  • FTP monitoring and downloading of new files
  • MEF + Plug-In not updating
  • Efficient handling of super wide, but not so tall, bitmap?
  • .NET 3.0 Unit Testing getting System.MethodAccessException calling .NET 2.0
  • Web Services vs Persistent Sockets
  • How do I dynamically reference incremented properties in C#?
  • Windows Installer (C#) error code 2869
  • Exception "The operation is not valid for the state of the transaction" using TransactionScope
  • Tools for listing database accesses from .NET code
  • Excel VSTO set selection
  • Creating a subscription based website in ASP.NET
  • Merging Resources Dictionaries
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk